19

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?

Brian
  • 14,610
  • 7
  • 35
  • 43
holy
  • 632
  • 2
  • 9
  • 18
  • Check this out: http://stackoverflow.com/questions/10483959/javah-error-android-app-activity-not-found/25989225#25989225 – Punith K Sep 23 '14 at 07:36

3 Answers3

34

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}

enter image description here

To run the tool, highlight the java source file in package explorer and run the tool.

enter image description here

Press F5 to refresh th project to see the newly generated file.

Community
  • 1
  • 1
Java42
  • 7,628
  • 1
  • 32
  • 50
2

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.

Sam R.
  • 16,027
  • 12
  • 69
  • 122
Kai Mechel
  • 753
  • 8
  • 19
0

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

halo89
  • 101
  • 1
  • 1