正在构建用于Oracle jvm的avahi(错误:jni.h未找到)

Building avahi for use in the Oracle jvm (error: jni.h not found)

本文关键字:jni 错误 用于 构建 Oracle jvm avahi      更新时间:2023-10-16

这是以下问题的后续:定义宏将case类实例转换为映射并返回时的编译错误

那里的答案解决了我最初的问题——我没有安装依赖项。但是,现在我有一个问题,因为ant clean all仍然无法找到jni.h。这可能是因为说明说要安装打开的jdk 6。是否有解决Oracle jdk 7的方法?下面是我得到的错误:

myUser@ubuntu:~/Downloads/avahi4j-0.1$ ant clean all
Buildfile: /home/myUser/Downloads/avahi4j-0.1/build.xml
clean:
     [exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src'
     [exec] rm -f avahi4j_Client.o avahi4j_EntryGroup.o avahi4j_Avahi4JConstants.o thread-watch.o avahi4j_ServiceBrowser.o avahi4j_ServiceResolver.o avahi4j_RecordBrowser.o libavahi4j.so ./*~
     [exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src'
   [delete] Deleting directory /home/myUser/Downloads/avahi4j-0.1/classes
init:
    [mkdir] Created dir: /home/myUser/Downloads/avahi4j-0.1/classes
jnilib:
     [exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src'
     [exec] gcc -I. -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux/ -I/usr/include/avahi-common  -O3 -fPIC -DVER_MAJ="0" -DVER_MIN="1"   -c -o avahi4j_Client.o avahi4j_Client.c
     [exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src'
     [exec] avahi4j_Client.c:23:17: fatal error: jni.h: No such file or directory
     [exec]  #include <jni.h>
     [exec]                  ^
     [exec] compilation terminated.
     [exec] make: *** [avahi4j_Client.o] Error 1
BUILD FAILED
/home/myUser/Downloads/avahi4j-0.1/build.xml:75: exec returned: 2 
Total time: 0 seconds

我找到问题了。在我的情况下,我需要对src/Makefile进行以下更改:

# It must be a JDK, not a JRE !!! 
#JDK_HOME := /usr/lib/jvm/java-6-sun 
JDK_HOME := /usr/lib/jvm/java-7-oracle 
#JDK_HOME := /usr/lib/j2sdk1.6-sun