Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javah error : cannot access activity

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.

like image 358
Prashant Singh Avatar asked May 19 '26 22:05

Prashant Singh


2 Answers

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
like image 173
Reimeus Avatar answered May 21 '26 15:05

Reimeus


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.

like image 38
Sergey Vakulenko Avatar answered May 21 '26 15:05

Sergey Vakulenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!