3

I am using Ubuntu Linux 32bit system, in terminal it shows no class specified

sanidhya09@sanidhya09:~/workspace/NdkFooActivity$ javah -jni -classpath adt-bundle-linux-x86/sdk/platforms/android-4.2/android.jar;bin/classes/ -d jni/ com.example.NdkFooactivity Error: no classes specified bash: bin/classes/: Is a directory

even i have tried this

sanidhya09@sanidhya09:~/workspace/NdkFooActivity/bin/classes$ javah
-jni -classpath adt-bundle-linux-x86/sdk/platforms/android-4.2/android.jar; com.example.NdkFooactivity.NdkFooActivity Error: no classes specified com.example.NdkFooactivity.NdkFooActivity: command not found

even i tried External tools configuration where in argument section i wrote

-d /home/sanidhya09/workspace/NdkFooActivity/jni -classpath /home/sanidhya09/adt-bundle-linux-x86/sdk/platforms/android-4.2/android.jar:/home/sanidhya09/workspace/NdkFooActivity/bin/classes com.example.NdkFooactivity

even in eclipse i get error saying make:

[HelloJni] Error 127 HelloJni C/C++ Problem

sschrass
  • 7,014
  • 6
  • 43
  • 62
Sanidhya Kumar
  • 714
  • 1
  • 6
  • 18

2 Answers2

2
sanidhya09@sanidhya09:~/workspace/NdkFooActivity$ javah -jni -classpath bin/classes:~/adt-bundle-linux-x86/sdk/platforms/android-16/android.jar com.example.NdkFooactivity.NdkFooActivity

should be fine, assuming your app package is com.example.NdkFooactivity and the class you are interested in is NdkFooActivity.

Note that you must pass the path to android.jar you actually used to compile. In my SDK, the directory is called android-16, not android-4.2. Also, you need to have the bin/classes directory in classpath. You may need more jars in your classpath.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
0

But there is one more thing that I would like to add. (And which has taken up most of my morning solving that)

While specifying the classpath = Refrain from using ./bin/classes:~/ProjectFolder/bin/classes ( the tilde representing the Home directory)

But use the "../../" to switch directories. For some reason javah doesn't recognizes the tilde operator for the home directory.

Also one other thing if the class has a dependency on other project then you would need that as well in the classpath

user@laptop:~/SomeProject javah -classpath ./bin/classes:../<Whereever the path is>/SomeOtherDependentProject:../<Path to android-sdk>/android.jar <Qualified class path>
Amit Ahire
  • 303
  • 4
  • 10