Reputation: 3793
I was trying to make a .h file using Javah for my Android NDK application.I am using cygwin to do the same for me.
Fixing the workspace to bin folder of my current application, I executed this command :-
javah -classpath /cygdrive/c/Android/android-sdk/platforms/android.jar myNDK\bin\classes my.first.NDK.MyNDKActivity
However, it is consistently giving the following error :-
error: cannot access myNDKbinclasses
class file for myNDKbinclasses not found
javadoc: error - Class myNDKbinclasses not found.
error: cannot access my.first.NDK.MyNDKActivity
class file for my.first.NDK.MyNDKActivity not found
javadoc: error - Class my.first.NDK.MyNDKActivity not found.
Error: No classes were specified on the command line. Try -help.
Can anyone help me in solving this issue ?
I also tried to go to the folder containing the java file and execute the javah there, but still I was getting same error :-
error: cannot access MyNDKActivity
class file for MyNDKActivity not found
javadoc: error - Class MyNDKActivity not found.
Error: No classes were specified on the command line. Try -help.
That somehow depicts the problem is due to some permission problem, I guess.
Upvotes: 3
Views: 4989
Reputation: 11
maybe it can work!add the option [-bootclasspath] of your sdk path.
javah -bootclasspath /home/lmdyyh/development/adt-bundle-linux-x86-20131030/sdk/platforms/android-19/android.jar -classpath bin/classes -d jni com.myndk.Myndk
Upvotes: 1
Reputation: 3793
Finally, I resolved my issue. There was a problem with the classpath I was using. Here goes the final solution :-
Where to execute the command from $PROJECT_DIRECTORY/src
The ant part of the Android build system actually places the class files in bin/classes
. So the classpath should be of form $PROJECT_DIRECTORY/bin/classes
javah -classpath ../bin/classes my.first.NDK.MyNDKActivity
Upvotes: 1
Reputation: 1667
What is android.jar is doing in your line?!
Also, MyNDKActivity is the class which contains native signatures?
I used javah in this form (its works for me):
javah -d output/ -classpath /home/bod/path/to/eclipse/workspace/project/classes com.myapp.NDKBridge
where:
-d output/ is directory to collect generated headers
-classpath /home/.../classes - folder with classes in your project
com.myapp.NDKBridge - name of class which declare native signatures.
Upvotes: 1
Reputation: 159844
You seem to be missing a separator on your classpath:
javah -classpath /cygdrive/c/Android/android-sdk/platforms/android.jar:myNDK/bin/classes my.first.NDK.MyNDKActivity
Upvotes: 2