views:

829

answers:

2

javah -jni JavaHowTo 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.

Hi guys,

       i have set the class path correctly.

But still i am getting this javah error. Any solution for this will be much helpful.

thanks in advance

A: 

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/JavaHotTo.class

run javah from

    /home/user
Glen
+1  A: 

Hi, 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...

dilig0
@dilig0 I get that javadoc error too if the .class file can't be found. Maybe javah uses javadoc to add the comments to the .h file
Glen
The Error is solved. i changed the environmental variables and now it works fine.thanks friends
krishnakumar