JDK 1.8 on Linux missing JNI include file

后端 未结 3 2023
终归单人心
终归单人心 2021-02-12 17:33

I am trying to compile the following project:

https://github.com/entropia/libsocket-can-java

I always get this error message? Does anyone know

3条回答
  •  我在风中等你
    2021-02-12 18:06

    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
    

    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/
    

提交回复
热议问题