Reputation: 177
I want to create the head file in IntelliJ IDEA. This is the way I do it:
file>setting>Tools>External Tools
then I click +, specify the title and set the parameters as follow:
Program: C:\Program Files\Java\jdk1.8.0_25\bin
Parameters: -d C:\Users\Administrator\Documents\Visual Studio 2013\Projects\JniExampleLibrary -jni Example.JniExample
Working Directory: C:\Program Files\Java\jdk1.8.0_25\bin
but after clicking ok, there is no JniExample.h file in the path defined above with -d
Would you please tell me what is the problem with it?
Thanks in advance
Upvotes: 16
Views: 12427
Reputation: 6222
I am using Java 11 (OpenJDK) to compile, so I do not have javah available.
Since now the option to create header files is included in javac, I added it as an compiler option.
(IntelliJ Community 2019.2, other versions should be similar)
Example:
-h C:/Development/Java/YourApp/cpp
I did not have any luck with "-h $FileDir$" or other macro commands of IntelliJ.
Upvotes: 8
Reputation: 389
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)
Upvotes: 34