Linux上的JDK 1.8缺少JNI包含文件 [英] JDK 1.8 on Linux missing JNI include file
问题描述
我正在尝试编译以下项目:
I am trying to compile the following project:
https://github.com/entropia/libsocket-can-java
我总是收到此错误消息?有谁知道如何解决它,它可能是Linux上的JDK 1.8.0.11(x64 Debian Wheezy)中的错误吗?
I always get this error message? Does anyone know how to fix it, is it possibly a bug in JDK 1.8.0.11 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"
^
推荐答案
看来是这样。 #includejni_md.h
将该文件包含在与 jni.h
相同的目录中,但它被放置在 linux
文件夹中。
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.
在以前的JDK版本中,似乎该文件和另一个文件放在 include / linux
文件夹,但 include
中的两个文件都有符号链接。
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
编辑
正如Absurd-Mind和Mikkel的评论中所述,还可以选择将该路径添加到makefile编译器选项中:
Edit
As stated in the comments by Absurd-Mind and Mikkel, there is also the option to add that path to the makefile compiler options:
-I$(JAVA_HOME)/include/linux/
这篇关于Linux上的JDK 1.8缺少JNI包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!