VMware vSphere HTML Client SDK

Eclipse Setup

  1. Eclipse Configuration
  2. SDK Tools Eclipse Plug-in
  3. Virgo Server Setup
  4. Mac OS Notes
  5. Development Tips

This page contains setup instructions specific to the Eclipse IDE and Spring Tool Suite (STS).

1. Eclipse Configuration

Download the Eclipse version of your choice from eclipse.org (or the STS version of your choice from Spring Tool Suite) and install it anywhere on your disk. Eclipse comes in different packages, pick Eclipse IDE for Java EE Developers, not the smaller package Eclipse IDE for Java Developers.

Eclipse.ini

Before using Eclipse you should edit its Eclipse.ini file to set the Java JDK version and increase memory if necessary. On Mac OS the .ini file is hidden, right-click on the application icon and select Show Package Contents, the file is in Contents/MacOS.

Add these 2 lines to tell Eclipse to use your installed JDK. Remove any space before each line!

-vm
C:/<your JAVA_HOME directory>/bin/java.exe

Add or change these VM arguments to increase memory:

-Xmx1024m
-XX:MaxPermSize=512m

See more info in the Eclipse.ini wiki.

Eclipse preferences

Start Eclipse and go to Window > Preferences

In order to build SDK examples you need to set two VSPHERE_CLIENT_SDK variables.

Go to Window > Preferences > General > Workspace > Linked Resources as shown below, and add a new path variable VSPHERE_CLIENT_SDK pointing to the location of your html-client-sdk directory.

Go to Window > Preferences > Java > Build path > Classpath variables as shown below, and add a path variable VSPHERE_CLIENT_SDK pointing to the location of your html-client-sdk directory.

2. SDK Tools Eclipse Plug-in

The vSphere HTML Client SDK includes an Eclipse plug-in with various tools to help your HTML plug-in development, including a wizard to create UI and service plug-in projects easily.

Before trying to install new software make sure that Eclipse's Network Connections settings are correct, otherwise the UI won't be responsive.
If your work location requires a proxy go to Window > Preferences > General > Network Connections to set it up.

After you restart Eclipse you can verify that the plugin is correctly installed:

For more information on how to use this wizard please see the tutorial doc.

3. Virgo Server setup

This section explains how to install the Eclipse Virgo Tools and use the Virgo server within the Eclipse IDE. This is not a requirement but it will improve your development experience.

If you are using an old Eclipse version (before Luna 4.4) please see this Eclipse Virgo Tooling wiki.

Once you have restarted Eclipse:

In the next screen, for the installation directory, select the server directory inside your SDK folder.
(The message "Valid installation" will popup at the top once you select the right directory). You can leave the default server name as is.

Virgo Run Configuration

On Mac OS you need to define the environment variable VMWARE_CFG_DIR in a Virgo Run Configuration as shown below otherwise the server won't start'. See the next section for more Mac tips.

On Windows, it shouldn't be necessary as long as you defined the environment variable VMWARE_CFG_DIR before starting Eclipse (value is C:/ProgramData/VMware/vCenterServer/cfg/).

Additional Virgo Configuration

Double click on the server instance in the Server view, this opens an Overview page.

4. Mac OS Notes

The Finder hides many files by default, it is easiest to make them all visible using this command in your terminal window: defaults write com.apple.Finder AppleShowAllFiles YES

The Eclipse.ini or STS.ini file used to configure startup options is hidden, right-click on the application icon and select Show Package Contents, the file is in Contents/MacOS.

When starting Virgo under your user account (on the command line or from Eclipse) your plugin code may not have read/write permissions in local directories being used. The solution is to set the proper permission for your account. For instance, when saving setting values in the globalview sample, you will get an error if you haven't set write permission to /var/lib/storage because the data is saved in /var/lib/storage/globalview.

Environment variables

Environment variables are a little tricky on the Mac.
When using scripts on the command line (Terminal window) the easiest is to set them in your ~/.bash_profile. But you need to start Eclipse from the same terminal window with Open [PATH-TO-ECLIPSE-APP]
See this article for other solutions.

However this won't work if you run the Ant build scripts from Eclipse unless you start Eclipse from the command line which is not always practical. The recommended solution is to edit the Ant Runtime Preferences, adding the property for VSPHERE_SDK_HOME as shown below:

Make sure NOT to use quotes around your paths, even if they contain spaces!

5. Development tips

Ant builder

An easy way to compile resource files is to setup an Ant Builder in your Eclipse project configuration as shown below. It executes the build-resources.xml script each time you build the project:

More on Virgo Tools

You can take advantage of the Virgo server editor to learn more about the currently installed bundles and their dependencies. This is a good place to start to verify that all your components are deployed and have the correct dependencies.

Open the server editor, double-click on the Virgo instance in the Eclipse Server view, select the Bundle Overview tab and click the yellow button at the top to refresh the list of bundles. Select any bundle to see its details, including the manifest's content and the packages imported and exported.

Click the link Show dependency graph for bundle to open the Dependency tab for the selected bundle. For instance the graph for MyService shows a simple package dependency with the UI bundle MyPlugin: this was configured in MyPlugin's manifest earlier so that the client code can reference the interface com.mycompany.myService.MyService.

Clicking on the node MyPlugin reveals all the other dependencies from that bundle (they are the ones generated by the wizard in the manifest so that MyPlugin can communicate with Java services).

For more information see the Virgo Guides available through Help > Help Contents.

See also: Javascript API - Java API - FAQ