Command:
javah -jni JavaHowTo
Result:
error: cannot access JavaHowTo
class file for JavaHowTo not found
javadoc: error -
javah does not work properly from Cygwin terminal:
$ cd /cygdrive/c/Workspace/prj/bin
$ ls com/example/JavaHotTo.class
com/example/JavaHotTo.class
$ javah com.example.JavaHowTo
Error: Could not find class file for 'com.example.JavaHowTo'.
But it works perfectly using the option -classpath .
$ javah -classpath . com.example.JavaHowTo
$ ls *.h
com_example_JavaHotTo.h
More tricks:
-jni is by default, therefore it is not require.classpath javah on MS-Windows prefers path à la C:\Workspace\prj\bincygpath -w /cygdrive/c/Workspace/prj/bin to convert into MS-Windows format-d your/jni/headers/path to write headers in another directoryjavah creates the path your/jni/headers/path if it does not exist (see below)
$ javah -d jni/headers -classpath . com.example.JavaHowTo
$ ls jni\headers
com_example_JavaHotTo.h
$ javah -d jni\path -classpath . com.example.JavaHowTo
$ ls jni\path
com_example_JavaHotTo.h