|
||||||||
PREV NEXT | FRAMES NO FRAMES |
See:
Description
Packages | |
---|---|
com.vmware.vmguestlib |
These Java classes provide support for using the VMware Guest API in a Java programming environment. Please see the VMware Guest SDK documentation for an overview and detailed description of the VMware Guest API.
The following code demonstrates how to use the API from within a Java program:
try { VMGuestLibInterface handle = VMGuestLibHandle.open(); // First refresh the information for this handle handle.updateInfo(); // Query and print some information long hostProcessorMhz = handle.getHostProcessorSpeed(); long vmMemSizeMB = handle.getMemSizeMB(); BigInteger elapsedMs = handle.getElapsedMs(); System.out.println("Host physical processor speed (mhz): " + hostProcessorMhz); System.out.println("Configured memory size (MB): " + vmMemSizeMB); System.out.println("Elapsed uptime (ms): " + elapsedMs); // We're done with the handle, so close it handle.close(); // No further operations are allowed on a handle once it has been // closed, so this will generate an exception handle.updateInfo(); } catch (VMGuestLibErrorException e) { System.err.println("VMGuestLib API Error: " + e); }
To use the VMware Guest API from within a Java program, the class archive and JNI support library must be available to the Java environment along with the VMware Guest API run-time component library. The specific files required depend on the guest operating system, as summarized in the following table:
Component | Windows filename | Linux filename |
---|---|---|
Run-Time Library | vmGuestLib.dll | libvmGuestLib.so |
JNI Support Library | vmGuestLibJava.dll | libvmGuestLibJava.so |
Java Class Archive | vmGuestLibJava.jar | vmGuestLibJava.jar |
|
||||||||
PREV NEXT | FRAMES NO FRAMES |