Reputation:
Ok, guys, I've read so many examples of javah usage and still got no luck. I have Eclipse Android project, so I try following:
cd /path_to_project/
javah -classpath ./bin/classes com.package.ClassName
What I get:
class file for android.app.Activity not found
Ok, so, it sees my class and I just need to add android.jar to classpath:
javah -classpath ./bin/classes:path_to_sdk/android.jar com.package.ClassName
And I get:
Could not find class file for com.package.ClassName
"You're kidding me! You just saw it and now you can't find it!", I say.
Please, any help! I'm desperate here.
Tried compiling simple java class with javac and then using javah - it works fine.
My environment: Windows 7, cygwin.
Upvotes: 0
Views: 1457
Reputation: 76
I'll share what I've done to get javah to work for me. I hope it helps.
For example, I've got a project with a package name of 'com.android.MyProgram'. The activity source code file is located in the directory 'Path-To-Project/src/com/android/MyProgram' and the source code file is named 'MyProgram.java' and instantiates a class named 'MyProgram'. My native code is in the directory named 'Path-To-Project/jni'. I would use the following command line to run 'javah' for this project, run from the 'Path-To-Project' directory:
javah -cp src -d jni com.android.MyProgram.MyProgram
Again, I hope this helps.
Upvotes: 5