Results 1 to 3 of 3
- 10-14-2010, 02:51 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 13
- Rep Power
- 0
mistake The import com.vmware.vim25.CustomFieldDef is never used
Hi, everyone.
I want to make this program with java eclipse. But it is coming all the time mistake :confused: :
The import com.vmware.vim25.CustomFieldDef is never used
The import com.vmware.vim25.Permission is never used
The method waitForMe() from the type Task is deprecated
The method waitForMe() from the type Task is deprecated
The method waitForMe() from the type Task is deprecated
The method waitForMe() from the type Task is deprecated
Is it form the library? In Google I can't get answer. I will be happy if someone can give some explanation.
This is the source code:
Java Code:package com.vmware.vim25.co.samples; import java.net.URL; import com.vmware.vim25.CustomFieldDef; import com.vmware.vim25.Permission; import com.vmware.vim25.mo.Folder; import com.vmware.vim25.mo.InventoryNavigator; import com.vmware.vim25.mo.ServiceInstance; import com.vmware.vim25.mo.Task; import com.vmware.vim25.mo.VirtualMachine; /** * [color="blue"]VMware Infrastructure (vSphere) Java API[/color] * @author Steve Jin / Modified by Michael Hopf */ public class VMpowerOps { public static void main(String[] args) throws Exception { String vmname = "Test_VM"; /* other ops: reboot|poweron|poweroff|reset|standby|suspend|shutdown */ String op = "standby"; ServiceInstance si = new ServiceInstance(new URL("https://server1.fireline.de/sdk"), "root", "password", true); Folder rootFolder = si.getRootFolder(); VirtualMachine vm = (VirtualMachine) new InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", vmname); if(vm==null) { System.out.println("No VM " + vmname + " found"); si.getServerConnection().logout(); return; } if("reboot".equalsIgnoreCase(op)) { vm.rebootGuest(); System.out.println(vmname + " guest OS rebooted"); } else if("poweron".equalsIgnoreCase(op)) { Task task = vm.powerOnVM_Task(null); if(task.waitForMe()==Task.SUCCESS) { System.out.println(vmname + " powered on"); } } else if("poweroff".equalsIgnoreCase(op)) { Task task = vm.powerOffVM_Task(); if(task.waitForMe()==Task.SUCCESS) { System.out.println(vmname + " powered off"); } } else if("reset".equalsIgnoreCase(op)) { Task task = vm.resetVM_Task(); if(task.waitForMe()==Task.SUCCESS) { System.out.println(vmname + " reset"); } } else if("standby".equalsIgnoreCase(op)) { vm.standbyGuest(); System.out.println(vmname + " guest OS stoodby"); } else if("suspend".equalsIgnoreCase(op)) { Task task = vm.suspendVM_Task(); if(task.waitForMe()==Task.SUCCESS) { System.out.println(vmname + " suspended"); } } else if("shutdown".equalsIgnoreCase(op)) { Task task = vm.suspendVM_Task(); if(task.waitForMe()==Task.SUCCESS) { System.out.println(vmname + " suspended"); } } else { System.out.println("Invalid operation. Exiting..."); } si.getServerConnection().logout(); } }Last edited by Fubarable; 10-14-2010 at 03:05 PM. Reason: Moderator Edit: Code tags added
- 10-14-2010, 03:13 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Eclipse can organize your imports (it removes the imports that aren't used and adds the imports your class needs) by pressing Ctrl-Shift-O (that's a capital Oh). See what happens.
kind regards,
Jos
- 10-14-2010, 03:26 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 13
- Rep Power
- 0
Similar Threads
-
able to compile but unable to run. can any one tell me wats the mistake?
By mallik.koneru in forum New To JavaReplies: 11Last Post: 05-18-2010, 01:49 PM -
i can't see the mistake
By PVL268 in forum New To JavaReplies: 3Last Post: 04-29-2009, 05:26 AM -
i can't see the mistake
By PVL268 in forum New To JavaReplies: 2Last Post: 04-28-2009, 06:30 AM -
PLEASE!!!help me to find mistake
By sasha20 in forum New To JavaReplies: 1Last Post: 01-11-2008, 10:50 AM -
Newbie can't spot his mistake :(
By naxalyte in forum New To JavaReplies: 4Last Post: 11-21-2007, 07:31 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks