[libvirt] RFC: libvirt java bindings based on JNA

Bryan Kearney bkearney at redhat.com
Thu Jul 30 14:16:03 UTC 2009


Thomas Treutner wrote:
> On Thursday 30 July 2009 13:57:44 Thomas Treutner wrote:
>> On Thursday 30 July 2009 03:30:20 Bryan Kearney wrote:
>>> Can you try the new release? It is cleaned up.. and should be easier to
>>> consume. Let me know if there are issues.
>> Thanks, works fine so far (liblibvirt.so issue is gone).
> 
> Sorry for the mixup, but I wasn't using the new version, Eclipse was 
> accidentially configured for JNI version. It still doesn't work, so I looked 
> in the code and did a quick experiment:
> 
> 
> src/main/java/org/libvirt/jna/Libvirt.java:23:
> -Libvirt INSTANCE = (Libvirt) Native.loadLibrary("libvirt", Libvirt.class);
> +Libvirt INSTANCE = (Libvirt) Native.loadLibrary("virt", Libvirt.class);

per a discussion with the JNA guys, they first try the name, and then 
prepend lib onto it. So.. if libvirt.so is in your LD_LIBRARY_PATH both 
should work. However, I have commited a change to only load lib. Go 
ahead and try that.

> 
> 
> and it works (without any symlinks hacks, of course). I don't have any 
> experience with JNA, but I assume that somewhere a "lib" is being prepended 
> and therefore "libvirt" is over-specified. 
> 
> What I still don't understand is my it is presumably working for you, and not 
> for me:
> 
> JNA 3.2.1
> 
> $ java -version                                                      
> java version "1.6.0_14"
> Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
> Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)
> $ javac -version                                                     
> javac 1.6.0_14
> 
> btw, I don't see a JNA-branch in git://libvirt.org/libvirt-java.git anymore - 
> is JNI-version now obsolete?
> 
> 
Yes.. 0.3.0 will be based on JNA. I will actively make changes to the 
0.3.0 bits.

-- bk





More information about the libvir-list mailing list