i'm having a problem with connecting to QEMU with Libvirt API, here is the code:
import org.libvirt.Connect;
import org.libvirt.ConnectAuth;
import org.libvirt.ConnectAuthDefault;
import org.libvirt.LibvirtException;
import org.libvirt.NodeInfo;
public class Main
{
public static void main(String[] args)
{
System.setProperty("jna.library.path", "/home/johann/workspace/LibvirtTest/lib");
try {
ConnectAuth ca = new ConnectAuthDefault();
Connect conn = new Connect("qemu+tcp://192.168.122.0/24", ca, 0);
NodeInfo ni = conn.nodeInfo();
System.out.println("model: " + ni.model + " mem(kb):" + ni.memory);
} catch(LibvirtException le) {
le.printStackTrace();
}
}
}
The problem is with the line
Connect conn = new Connect("qemu+tcp://192.168.122.0/24", ca, 0);
It makes the compiler throws this exception
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.jna.Native.pointerSize()I
at com.sun.jna.Native.pointerSize(Native Method)
at com.sun.jna.Native.<clinit>(Native.java:88)
at org.libvirt.jna.Libvirt.<clinit>(Unknown Source)
at org.libvirt.Connect.<clinit>(Unknown Source)
at Main.main(Main.java:16)
I have found this address and port in the Virtual Machine Manager localhost QEMU details, but it doesn't seems to work...
Thanks in advance! :)