When you download the SDK, you can find the Java sample programs and related files in the following directories.

  • SDK\vsphere-ws\java\JAXWS\samples\com\vmware – Top-level directory for Java samples. Details listed in the following table.
  • SDK\vsphere-ws\java\JAXWS\samples\com\vmware\security – Credential store utilities
  • SDK\vsphere-ws\java\JAXWS\samples\com\vmware\vim25 – Stub directory. The vim25 directory contains stubs for release 2.5 and later.
  • SDK\vsphere-ws\java\JAXWS\samples\com\vmware\vm – samples written for a single VM
Directory Example Description
alarms VMPowerStateAlarm Create an alarm to monitor a virtual machine's power state.
cim CIMReader

Walks the Common Information Model (CIM) data associated with an ESXi host.

connection BasicConnection (among others) Shows how to set up a vSphere connection with user name and password.
events EventFormat Retrieve and format the last event from the host daemon or vpxd. Includes a function that formats the event message.
EventHistoryCollectorMonitor Demonstrates how to create and monitor an EventHistoryCollector. Uses the latestPage property of EventHistoryCollector to filter the events.
VMEventHistoryCollectorMonitor Standalone client that demonstrates how to perform the following tasks:

(1) Logging into the web service. (2)Creating EventHistoryCollector filtered for a single virtual machine. (3) Monitoring events using the latestPage property of the EventHistoryCollector.

fcd FcdCreate, FcdDelete Create and delete a first class disk (FCD) virtual storage object.
FcdAttachToVM, FcdDetachFromVM Attach or detach FCD to or from VM.
FcdRegisterLegacyDisk Register legacy disk as a first class disk.
general Browser Print all managed entities and for each entity its type, reference value, property name, property value, inner object type, inner reference value and inner property value.
Connect Connect to an ESXi host or a vCenter Server system.
Create Create a managed entity such as a folder, datacenter, or cluster.
Delete Delete a managed entity from the inventory tree. The managed entity can be a virtual machine, a ClusterComputeResource, or a folder.
GetCurrentTime Retrieve the current time from the vSphere Server.
GetHostName Retrieve the hostname of the ESXi Server.
GetUpdates Demonstrates how to use the PropertyCollector to monitor one or more properties of one or more managed objects. In particular this sample monitors one or all virtual machines and all hosts or one host for changes to some basic properties.
LicenseManager Demonstrates uses of the licensing API using License managed object reference.
Move Move a managed entity from its current location in the inventory to a new location in a specified folder
PropertyCollector Illustrates the use of the PropertyCollector API.
RemoveManagedObject Destroy or unregister a managed inventory object like a Host, VirtualMachine, or Folder.
Rename Rename a managed entity object.
SearchIndex Illustrates the use of the SearchIndex API.
SimpleClient Connect to the server, log in, list the inventory contents (managed entities) at the console, and log out.
TaskList Display a list of tasks performed on a specified managed object.
guest CreateTemporaryFile Create a temporary file inside a virtual machine.
DownloadGuestFile Download a file from the guest to a specified path on the host where the client is running.
RunProgram Run a specified program inside a virtual machine. RunProgram re-directs output to a temporary file inside the guest and downloads the output file.
UploadGuestFile Upload a file from the client machine to a specified location inside the guest operating system.
hcl HCIBatchAddHostAndExtendCluster

Call batch-add-host to add four or more new hosts to an HCI cluster.

HCIComputeOnlyCluster Call HCI configure to create a simple cluster configuration.
host AcquireSessionInfo Acquire session with a vCenter Server or ESXi host and print a CIM service ticket and related session information to a file.
AddVirtualNic

RemoveVirtualNic

Add a virtual NIC to a port group on a virtual switch. Remove a virtual NIC from a port group.
AddVirtualSwitch

RemoveVirtualSwitch

Add a virtual switch to a host. Remove a virtual switch from the host.
AddVirtualSwitchPortGroup

RemoveVirtualSwitchPortGroup

Add a port group to a virtual switch. Remove a port group from a virtual switch.
DVSCreate Create a distributed virtual switch.
HostProfileManager Demonstrates the use of HostProfileManager and ProfileComplainceManager.
NIOCForDVS Add a network resource pool to a distributed virtual switch.
httpfileaccess GetVMFiles Retrieve configuration files, snapshot files, log files, and virtual disk files of a virtual machine; place them on the system on which the program is run.
PutVMFiles Put virtual machine files into a specified datacenter and datastore; register and reconfigure the corresponding virtual machine.
performance Basics Display available performance counters or other metadata for an ESXi host.
History Read performance measurements from the current time, or from a specified start time, for a specified duration.
PrintCounters Write the available counters of a managed entity into the specified file at the specified location. The managed entity can be a host system, a virtual machine, or a resource pool.
RealTime Display performance measurements from the current time at the console.
VItop An ESXtop-like sample application that lets administrators specify the CPU and memory counters by name to obtain metrics for a specified host.
VIUsage Create a GUI for graphical representation of the counters.
scheduling DeleteOneTimeScheduledTask Demonstrates deleting a ScheduledTask.
OneTimeScheduledTask Demonstrates creating a ScheduledTask using the ScheduledTaskManager.
WeeklyRecurrenceScheduledTask Demonstrates creating a weekly recurrent scheduled task.
scsilun SCSILunName Display the CanonicalName,Vendor, Model, Data, Namespace and NamespaceId of the host’s SCSI LUN.
security credstore Base64 A fast, memory efficient class that encodes and decodes to and from BASE64 in full accordance with RFC 2045.
CredentialStore Create an example credential store.
CredentialStoreAdmin A command-line tool that provides complete access to the credential store backing file on the local machine.
CredentialStoreCipher

This class uses the JVM provided classes in javax.crypto to encrypt and decrypt text.

CredentialStoreFactory Factory class providing instances of a credential store.
CredentialStoreImpl Implementation class for CredentialStoreAdmin.
CredentialStoreStorage This class provides the same functionality as FileInputStream, except that the close() method is overridden so that FileInputStream class’ close() method does not get called.
simpleagent CreateUser Create a user account and password and store them in the local credential store.
SimpleAgent Access the local credential store to obtain a single user account for login to a server.
storage CreateStorageDRS Creates storage DRS.
SDRSRecommendation Runs storage DRS on an SDRS cluster to obtain SDRS recommendations.
SDRSRules Configures rules for an SDRS cluster.
vApp OVFManagerExportVapp Demonstrates the OvfManager by exporting VMDKs and OVF Descriptors of all VMs in the vApps.
OVFManagerExportVMDK Demonstrates how the OvfManager exports VMDKs from a VM to the localSystem.
OVFManagerImportLocalVapp Use this class to import or deploy an OVF Appliance from a local drive.
OVFManagerImportVAppFromUrl Use this class to import or deploy an OVF Appliance from a specified URL.
vim25 This directory contains the many Java classes that define JAX-WS bindings to the vSphere API.
vm VMApplyEvc Apply a per-VM extended vMotion compatibility (EVC) setting to an existing virtual machine.
VMClone Locate an existing virtual machine on the vCenter Server system, make a template from this virtual machine, and deploy instances of the template onto a datacenter.
VMCreate Create a virtual machine. Different command-line input creates the virtual machine in different ways.
VMDeltaDisk Create a delta disk on top of an existing virtual disk in a virtual machine, and simultaneously removes the original disk using the reconfigure API.

Use delta disks in conjunction with linked virtual machines.

VMDiskCreate Create a virtual disk.
VMLinkedClone Create a linked virtual machine from an existing snapshot.
VMManageCD Configure a CDROM for a virtual machine. Also list information about the CDROMs associated with a virtual machine.
VMManageFloppy Configure a floppy drive for a virtual machine. Also list information about the floppy drives associated with a virtual machine.
VMotion Check whether migration with VMotion is feasible between two hosts. Perform a migration if the hosts are compatible.
VMpowerOps Perform power operations on a virtual machine.
VMPromoteDisks Consolidate a linked virtual machine by using the VirtualMachine.PromoteDisks method.
VMReconfig Reconfigure a virtual machine. Includes reconfiguring the disk size and disk mode.
VMRelocate Relocate a linked virtual machine using disk move type.
VMSnapshot Perform virtual machine snapshot operations
XVCvMotion

Relocate virtual machine across from one vCenter Server to another.

XVMotion Relocate virtual machine to the computing resource recommended by the DRS.