Richard Richard - 4 months ago 27
Java Question

how to make jni.h be found?

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.

jdb jdb
Answer

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.