Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
282 views
in Technique[技术] by (71.8m points)

java native interface - android - javah doesn't find my class

I am having troubles generating the C header file for JNI using javah.

Here's the script I use while standing in the <project-dir>in directory:

javah -classpath C:PROGRA~2Androidandroid-sdkplatformsandroid-8android.jar com.test.JniTest

As return I get:

ERROR: Could not find class file for 'com.test.JniTest'.

Even though the class JniTest certainly is in comest.

What am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You specify the classpath to contain only android.jar.

You also need to include the location where your classes are stored. In your case it is the current directory, so you need to use . (separated by ; on Windows). The invocation should look like this:

javah -classpath C:PROGRA~2Androidandroid-sdkplatformsandroid-8android.jar;. com.test.JniTest

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...