Reputation: 632
I am using Eclipse to generate a JNI header file. I looked in program files\java\jre6\bin
and found a lot of .exe and .dll files, but I couldn't find the command javah
which was in the documentation for using JNI to create bindings to C libraries.
Any help?
Upvotes: 19
Views: 18482
Reputation: 101
Location
// javah.exe path
C:\Program Files\Java\jdk1.7.0_79\bin\javah.exe
Working Directory
${workspace_loc:/${project_name}/bin}
Arguments
-classpath ${project_classpath} -v -d ${workspace_loc:/${project_name}/jni} ${java_type_name}
open java class and run tools
Upvotes: 0
Reputation: 753
Just some info...
Unfortunately the solution above did not work out for me, but the solution in this thread did:
Using javah -jni with an Eclipse project structure
With the above mentioned arguments, I got:
Exception in thread "main" java.lang.IllegalArgumentException:
Not a valid class name:path/to/project
I found out, that the problem was a space character in the path to my project. Wrapping the paths in quotes did help for the solution above.
Upvotes: 2
Reputation: 7706
Use the following panel to define a new external tool for javah.exe.
Point "Location" to the javah.exe tool.
Set "Working Directory" to
${workspace_loc:/${project_name}/bin}
Set "Arguments" to:
-classpath ${project_classpath} -v -d ${workspace_loc:/${project_name}/src} ${java_type_name}
To run the tool, highlight the java source file in package explorer and run the tool.
Press F5 to refresh th project to see the newly generated file.
Upvotes: 34