VMware {code} Community
kai84
Contributor
Contributor

How to run Java Samples In VMware-vSphere-SDK-5.5 ?

Hi:

     VMware-vSphere-SDK-5.5  that different 5.1.

     In 5.1 ,we use run Samples on "main" method.

     For example:

args = new String[6];

args[0] = "--username";

args[1] = "root";

args[2] = "--password";

args[3] = "pass123word";

args[4] = "--url";

args[5] = "https://xxx.xx.xx.10/sdk";

getConnectionParameters(args);

if (help) {

    printUsage();

    return;

}

connect();

getCurrentTime();

     I can run it by Java Application on eclipse,it work!

     But, in 5.5

     the code is:

  @Action

    public void getCurrentTime() throws RuntimeFaultFaultMsg {

        XMLGregorianCalendar ct = vimPort.currentTime(this.getServiceInstanceReference());

        SimpleDateFormat sdf =

                new SimpleDateFormat("yyyy-MM-dd 'T' HH:mm:ss.SSSZ");

        System.out.println("Server current time: "

                + sdf.format(ct.toGregorianCalendar().getTime()));

    }

     yes,the code is sample,but i do not how can i run this sample!

     Thanks!

0 Kudos
1 Reply
mittim12
Immortal
Immortal

I have moved this from VMware® Horizon View™ to vSphere SDK for Java

it doesn't look very active here so if you don't get any responses I will move it over into vSphere 5.5

0 Kudos