Command:
javah -jni JavaHowTo
Result:
error: cannot access JavaHowTo
class file for JavaHowTo not found
javadoc: error - Class JavaHowTo not found.
Error: No classes were specified on the command line. Try -help.
I have set the class path correctly, but still i am getting this javah
error.
Any solution for this will be much helpful.
Try
javah -jni com.example.JavaHowTo
where com.example
is your package.
You also need to run javah from the directory containing com/example/JavaHowTo.class
e.g. if your structure is
/home/user/com/example/JavaHowTo.class
run javah from
/home/user
The following worked for me (Win7):
javah -classpath bin/classes -jni -d jni com.my.javaclass
I run this from the app main directory.
The problem was in the sub-directory classes
I successfully use javah every day from my build scripts with the following options:
javah -d <outputdir> -classpath <classpath> <fully_qualified_class>
where:
'outputdir' is the directory where to put the generated header file
'classpath' contains an absolute path to the directory containing your root package (as mentionned by Glen)
'fully_qualified_class' is the name of the class containing native methods without .class extension
-jni option is not required (set by default)
Anyway you should check your class file has been generated: quite surprised you get a javadoc error too...
I encountered the same error and using http://www.inonit.com/cygwin/jni/helloWorld/header.html link I was able to successfully generate the .h file. I used the following command
C:\Program Files\Java\jdk1.6.0_21\bin>javah -d C:\Prachi\Android\Workspace_QP_re
structure\HelloWorld\bin\example\jni -classpath C:\Prachi\Android\Workspace_QP_r
estructure\HelloWorld\bin example.jni.HelloWorld
here example.jni is my package name and C:\Prachi\Android\Workspace_QP_re
structure\
is where my eclipse workspace path.
Hope this helps you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With