0

这是对以下问题的跟进:在定义宏以将案例类实例转换为映射并返回时编译错误

那里的答案解决了我最初的问题——我没有安装依赖项。但是,现在我有一个问题,因为ant clean all仍然无法找到jni.h. 这可能是因为说明说要安装 open 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
4

1 回答 1

0

我发现了问题。就我而言,我需要对以下内容进行更改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
于 2014-05-30T01:21:24.843 回答