Reputation: 4079
i am triyng to generate header file for native use (c/c++) from a java file using eclipse. from the command line i can only reach the javah when i am in this location :
C:\Program Files (x86)\Java\jdk1.7.0_51\bin>
but i cant reference my java class like so :
C:\Program Files (x86)\Java\jdk1.7.0_51\bin>javah -jni com.or.jnihelloworld.nativeclass
because the class located outside of this folder at :
C:\Users\Or Azran\workspace\JniHelloWorld\src\NativeLib.java
and i want to make this file in to a jni folder in :
C:\Users\Or Azran\workspace\JniHelloWorld\jni
how can i do it from command line? a good toturial will be also great
Upvotes: 0
Views: 2318
Reputation: 1066
There appears to be a couple of issues to solve here.
First. I'm not sure that your source code is set up correctly. If indeed your class is com.or.jnihelloworld.nativeclass then it should be in directory: C:\Users\Or Azran\workspace\JniHelloWorld\src\com\or\jnihelloworld\nativeclass.java
However, assuming that the class/directory is correct. The javah command uses -d to specify the output directory, and you can specify the path with -classpath so
javah -classpath "C:\Users\Or Azran\workspace\JniHelloWorld\src\" \
-d "C:\Users\Or Azran\workspace\JniHelloWorld\jni" com.or.jnihelloworld.nativeclass
should put the file where you want it.
Upvotes: 3