在Ubuntu下构建libvirt-java

时间:2014-03-31 12:51:28

标签: java oracle ubuntu libvirt

我想在Ubuntu 13.10下构建libvirt java,我有OpenJDK和Oracle JDK 1.7但是我收到以下错误:

$ ant build
Buildfile: /home/mustafa/libvirt-java/libvirt-java-0.5.1/build.xml

init:
     [copy] Copying 1 file to /home/mustafa/libvirt-java/libvirt-java-0.5.1

build:
    [javac] Compiling 63 source files to /home/mustafa/libvirt-java/libvirt-java-0.5.1/target/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
    [javac] /home/mustafa/libvirt-java/libvirt-java-0.5.1/src/main/java/org/libvirt/Library.java:41: error: cannot find symbol
    [javac]         Native.free(Pointer.nativeValue(ptr));
    [javac]               ^
    [javac]   symbol:   method free(long)
    [javac]   location: class Native
    [javac] 1 error
    [javac] 1 warning

我已经安装了jna,

# ll /usr/share/java/jna.jar
lrwxrwxrwx 1 root root 13 Haz  6  2011 /usr/share/java/jna.jar -> jna-3.2.7.jar

但是test.sh会出现以下错误:

# bash test.sh 
Error: Could not find or load main class test

我尝试使用OpenJDK 1.7,Oracle 6,Oracle 7但没有运气。怎么了?我在这里写的,(不是serverfault),因为它更像是一个Java问题。

1 个答案:

答案 0 :(得分:1)

看来您的JNA版本没有这样的方法(免费(长)) JNA 3.2.7 - http://grepcode.com/file/repo1.maven.org/maven2/net.java.dev.jna/jna/3.2.7/com/sun/jna/Native.java/ 您可以使用存在该方法的较新版本,例如 JNA 3.3.0 - http://grepcode.com/file/repo1.maven.org/maven2/net.java.dev.jna/jna/3.3.0/com/sun/jna/Native.java/