Using vSphere Java API in Jython and Other JVM languages
As a by-product, the vSphere Java API makes Jython programming a lot easier. The following is a very simple sample written in Jython to print out the name of the first virtual machine in inventory.
from java.net import * from com.vmware.vim25.mo import * si= ServiceInstance(URL(“https://sjin-dev1/sdk”),\ “root”, “password”, True) rootFolder = si.getRootFolder() vms = InventoryNavigator(rootFolder) \ .searchManagedEntities(“VirtualMachine”) print “Hello ” + vms.getName() si.getServerConnection().logout()
As you can see, it really brings in the benefit of VI Java API into Python community at almost no extra cost.