Fatal error: jni.h: No such file or directory while installing jPype

w2lame picture w2lame · Nov 14, 2013 · Viewed 8.6k times · Source

I am trying to install JPype on Ubuntu 13.04. I have Oracle Java 1.7 installed. But when I do so, I get the following error:

src/native/common/include/jpype.h:45:17: fatal error: jni.h: No such file or directory

Unlike a lot of similar questions on stackoverflow, the file isn't present on my system i.e.

locate jni.h

returns nothing. Yes, I have run sudo updatedb before issuing above command.

Answer

Samhain picture Samhain · Nov 14, 2013

You have installed a JRE and not a JDK.

To compile JNI native code, you need to install a JDK, which comes with the appropriate jni.h header, as well as the OS specific headers.

When you do that, update your include path to

-I <path_to_jdk>/include -I <path_to_jdk>/include/linux