I am pleased to tell you that the VI Java API I have developed got company formal approval to be open sourced. Please note that this project is a open source project under BSD license, not a VMware product. Please check out the License.txt file included in the downloadable jar file.
The key benefits of this API are:
• Enables OO programming with a well defined managed object model
• Reduces the need to use ManagedObjectReference
• Hides the complexity of the PropertyCollector
• Provides necessary utility classes to simplify VI SDK web interfaces
• Leverages current VI SDK web services interface while keeping it intact
The downloadable jar you will find in the download page is very small (264KBcompressed), but includes binary, source and sample code.
To quickly show you how the appications building on top of this API look like, I hereby show you a small sample:
public class HelloVM
public static void main(String args) throws Exception
CommandLineParser clp = new
String urlStr = "https://esx-server/sdk";
String username = "username";
String password = "password";
ServiceInstance si = new ServiceInstance(new URL(urlStr), username, password, true);
Folder rootFolder = si.getRootFolder();
VirtualMachine vm = (VirtualMachine) new InventoryNavigator(rootFolder).searchManagedEntities("VirtualMachine");
VirtualMachineConfigInfo vminfo = vm.getConfig();
VirtualMachineCapability vmc = vm.getCapability();
System.out.println("Hello "+ vm.getName());
System.out.println("GuestOS: " + vminfo.getGuestFullName());
System.out.println("Multiple snapshot supported: " + vmc.isMultipleSnapshotsSupported());
Compared wtih the similar code directly using VI SDK web services interface, you will find the above sample is much less in LOC, and more importantly much more
To find out more about this API, you can read two important docs: get started with VI Java API (2 pages) and object model of VI Java API (3 pages) at:
To download the API package, please go to:
I look forward to hearing from you, either bug/feature request/suggestion or anything else. As I said, this project is an open source effort, please feel free to contribute to the community.
I am using VI SDK 2.5. I try to get the value of multiHostSupported from the capability which is a property of* **Servic
it seems that it can't be accessed directly from the reference of ServiceInstance ... I tried other ways but does not work?
Do you know if there is a way to get it? or if there is simple way in SDK 4.0?
Thank you for your information.
And i tried to run your java sample code, but got the error "Exception in thread "main" java.lang.InstantiationError: com.vmware.vim25.VimPortType" . Can you give me some advices about this?