I'm trying to control VirtualBox with Java. so, I installed VirtualBox 4.1.0.
Host is Ubuntu 10.04.
And this is source code...
Code: Select all
import org.virtualbox_4_1.IVirtualBox;
import org.virtualbox_4_1.VirtualBoxManager;
public class VirtualManager {
public static void main(String[] args) {
VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
IVirtualBox vbox = mgr.getVBox();
System.out.println(“VirtualBox version: “ + vbox.getVersion() + “\n”);
// get first VM name
String m = vbox.getMachines().get(0).getName();
System.out.println(“\nAttempting to start VM ’“ + m + “’“);
// start it
mgr.startVm(m, null, 7000);
mgr.cleanup();
}
}
Exception in thread "main" java.lang.RuntimeException: vbox.home Java property must be defined to use XPCOM bridge
at org.virtualbox_4_1.VirtualBoxManager.createInstance(VirtualBoxManager.java:101)
at VirtualManager.main(VirtualManager.java:22)
what's wrong? what I miss?
thanks for reading.....and answer