arash javan arash javan - 2 years ago 322
Java Question

JDK 1.8 on Linux missing JNI include file

I am trying to compile the following project:

I always get this error message? Does anyone know how to fix it, is it possibly a bug in JDK on Linux (x64 Debian Wheezy)?

In file included from jni/de_entropia_can_CanSocket.h:2:0,
from jni/cansocket.cpp:23:
/opt/jdk1.8.0_11/include/jni.h:45:20: fatal error: jni_md.h: No such file or directory
#include "jni_md.h"

Answer Source

It seems so. #include "jni_md.h" would include the file in the same directory as jni.h, but it is placed in linux folder.

In previous JDK versions it seems that file and another were place in include/linux folder, but there are symlinks to both files in include.

So you can just create symlinks to both files:

$ sudo ln -s /opt/jdk1.8.0_11/include/linux/jni_md.h /opt/jdk1.8.0_11/include/jni_md.h
$ sudo ln -s /opt/jdk1.8.0_11/include/linux/jawt_md.h /opt/jdk1.8.0_11/include/jawt_md.h
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download