[libvirt] Question about the libvirt Java bindings
Bryan Kearney
bkearney at redhat.com
Mon May 24 12:18:20 UTC 2010
On 05/24/2010 05:18 AM, Dustin Xiong wrote:
> Dear all:
>
> I encounter a problem when I running the libvirt java bindings test
> program. I download the libvirt-java-0.4.3.tar.gz. Then compiled
> successful, but the test program can't running.
>
> # ant build
> Buildfile: build.xml
>
> init:
> [copy] Copying 1 file to /home/dustin/libvirt-java-0.4.3
>
> build:
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> # javac -classpath
> /home/dustin/libvirt-java-0.4.3/target/libvirt-0.4.3.jar test.java
> Note: test.java uses or overrides a deprecated API.
> Note: Recompile with -Xlint:deprecation for details.
>
> (I think this will not affect the use of libvirt library. It‘s just a
> warning.
>
> javac -classpath
> /home/dustin/libvirt-java-0.4.3/target/libvirt-0.4.3.jar test.java
> -Xlint:deprecation
> test.java:142: warning: [deprecation] networkLookupByUUID(int[]) in
> org.libvirt.Connect has been deprecated
> testN! etwork = conn.networkLookupByUUID(UUIDArray);
> ^
> 1 warning
>
> Maybe I am wrong?)
>
> # java -classpath
> .:/usr/share/java/jna.jar:/home/dustin/libvirt-java-0.4.3/target/libvirt-0.4.3.jar
> test
> Exception in thread "main" java.lang.UnsatisfiedLinkError: jnidispatch
> (/com/sun/jna/linux-i386/libjnidispatch.so) not found in resource path
> at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:592)
> at com.sun.jna.Native.loadNativeLibrary(Native.java:574)
> at com.sun.jna.Native.<clinit>(Native.java:104)
> at org.libvirt.jna.Libvirt.<clinit>(Unknown Source)
> at! org.libvirt.Connect.<clinit>(Unknown Source)
> &! nbsp;&nb sp; at test.main(test.java:43)
>
> I test other test.java, the results are the same.
> I don't know the libjnidispatch.so can't be find is caused by the
> libvirt-java or JNA library.
> How can I resolve the problem?
>
> My java environment as below:
> libjna-java-3.1.0-1
> sun-java6-jdk-6-15-1
> junit-3.8.2-3
>
> Thank you very much.
>
>
You need to add the jna jar to the classpath. Look at the test.sh
program in the downloaded tarball.
-- bk
More information about the libvir-list
mailing list