Skip to content

Instantly share code, notes, and snippets.

@jbruchanov
Created October 17, 2017 18:30
Show Gist options
  • Save jbruchanov/4daf6b55ffa08ea4627984e155be5581 to your computer and use it in GitHub Desktop.
Save jbruchanov/4daf6b55ffa08ea4627984e155be5581 to your computer and use it in GitHub Desktop.
JIDEA quick JNI header generation
Here are the IntelliJ IDEA settings I use to generate the .h file: (This applies to IDEA version 12.1.6, probably similar in other versions)
File->Settings->External Tools
Click the + button for the "Edit Tool" dialog
The following are the form name/value pairs I used:
Name: javah
Group: Java
Description: Java Native Interface C Header and Stub File Generator
Options: Check All
Show in: Check All
Tool Settings...
Program: $JDKPath$\bin\javah.exe
Parameters: -jni -v -d $FileDir$ $FileClass$
Working directory: $SourcepathEntry$
Click OK, Click OK
Navigate to your java class with the native method
With the java class being shown in the editor, go to Tools->Java->javah
Notice the .h file that was generated in the same directory as your class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment