In Ubuntu 12.04, I have jdk7 from sun/oracle installed. When locate jni.h
, it prints multiple locations
/usr/lib/jvm/java-6-openjdk-amd64/include/jni.h /usr/lib/jvm/jdk1.7.0_07/include/jni.h ...
In the header file generated by JDK, there is include <jni.h>
, and currently it complains
fatal error: jni.h: No such file or directory.
In my Makefile
, there is no specification of locations where jni.h
is. And I am asking if possible to configure certain system parameter to make path of jni.h
(say, /usr/lib/jvm/jdk1.7.0_07/include/jni.h
) to be known when being compiled.
jni. h is a C/C++ header file included with the JDK that maps Java types to their native counterparts. javah automatically includes this file in the application header files.
You have to tell your compiler where is the include directory. Something like this:
gcc -I/usr/lib/jvm/jdk1.7.0_07/include
But it depends on your makefile.
It needs both jni.h
and jni_md.h
files, Try this
gcc -I/usr/lib/jvm/jdk1.7.0_07/include \ -I/usr/lib/jvm/jdk1.7.0_07/include/linux filename.c
This will include both the broad JNI files and the ones necessary for linux
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With