[英]Building avahi for use in the Oracle jvm (error: jni.h not found)
This is a follow up to the following question: Compile errors when defining a macro to convert a case class instance into a map and back 这是对以下问题的解答: 定义宏以将案例类实例转换为映射并返回时的编译错误
The answer there resolved my initial problem -- I was not installing the dependencies. 那里的答案解决了我最初的问题-我没有安装依赖项。 However, now I have a problem because ant clean all
is still not able to find jni.h
. 但是,现在我有一个问题,因为ant clean all
仍然找不到jni.h
This is possibly because the instructions say to install open jdk 6. Is there a workaround for Oracle jdk 7. Here is the error that I'm getting: 这可能是因为说明说要安装open jdk6。Oraclejdk 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
I found the problem. 我发现了问题。 In my case, I needed to make the following change to src/Makefile
: 就我而言,我需要对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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.