On Mon, May 23, 2011 at 03:05:28PM +0800, 毛宏 wrote:
 I would like to use libguestfs to manage the virtual disk images of
 virtual machines on XenServer, which is a virtualization platform. 
What version of libguestfs and where did you get it from?
 When I try to do some test of the Java codes contained in the
libguestfs package, the following error promped up:
 
 Exception in thread "main" java.lang.UnsatisfiedLinkError: no guestfs_jni in
java.library.path
 at java.lang.ClassLoader.loadLibrary(Unknown Source)
 at java.lang.Runtime.loadLibrary0(Unknown Source)
 at java.lang.System.loadLibrary(Unknown Source)
 at com.redhat.et.libguestfs.GuestFS.<clinit>(GuestFS.java:44)
 at test.GuestFS005Load.main(GuestFS005Load.java:27)
 
 It seems that I need to build guestfs_jni before I could use libguestfs through Java. But
I am not clear how to get this "guestfs_jni".......
 Does anybody know how to fix this problem? Thank you very very much! 
If the *.so file is in some non-standard place, then you may need to
define java.library.path to be the directory containing
libguestfs_jni.so.1.  For example:
  java -Djava.library.path=/path/to/library Test
You may also need to set your classpath to contain the jar file.
On a Fedora host using the libguestfs-java Fedora package, I can run
libguestfs like this [see attachment for test program]:
  $ CLASSPATH=/usr/share/java/libguestfs-1.11.8.jar javac Test.java
  $ CLASSPATH=/usr/share/java/libguestfs-1.11.8.jar:. java Test
  $ virt-filesystems -a test.img --all --long
  Name         Type        VFS      Label  Size       Parent
  /dev/VG/LV1  filesystem  ext2     -      209715200  -
  /dev/VG/LV2  filesystem  unknown  -      209715200  -
  /dev/VG/LV1  lv          -        -      209715200  /dev/VG
  /dev/VG/LV2  lv          -        -      209715200  /dev/VG
  /dev/VG      vg          -        -      520093696  -
  /dev/sda     pv          -        -      520093696  -
  /dev/sda     device      -        -      524288000  -
Rich.
-- 
Richard Jones, Virtualization Group, Red Hat 
http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw