VirtualBox

Changeset 29166 in vbox


Ignore:
Timestamp:
May 6, 2010 3:27:02 PM (15 years ago)
Author:
vboxsync
Message:

some improvements to the Java API sample

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/java/tests/TestVBox.java

    r29101 r29166  
    1717public class TestVBox
    1818{
    19     public static void main(String[] args) {
     19    public static void main(String[] args)
     20    {
    2021        VirtualBoxManager mgr = VirtualBoxManager.getInstance(null);
    2122
    2223        System.out.println("\n--> initialized\n");
    2324
    24         try {
     25        try
     26        {
     27            IVirtualBox vbox = mgr.getVBox();
     28            System.out.println("VirtualBox version: " + vbox.getVersion() + "\n");
    2529
    26             IVirtualBox vbox = mgr.getVBox();
    27 
    28             System.out.println("vers="+vbox.getVersion());
     30            /* list all VMs and print some info for each */
    2931            IMachine[] machs = vbox.getMachines(null);
    30             //IMachine m = vbox.findMachine("SL");
    3132            for (IMachine m : machs)
    3233            {
    33                 System.out.println("mach="+m.getName()+" RAM="+m.getMemorySize()+"M");
     34                System.out.println("VM name: " + m.getName() + ", RAM size: " + m.getMemorySize() + "MB");
    3435            }
    3536
     37            /* do something silly, start the first VM in the list */
    3638            String m = machs[0].getName();
     39            System.out.println("\nAttempting to start VM '" + m + "'");
    3740            if (mgr.startVm(m, 7000))
    3841            {
     
    4447                System.out.println("cannot start machine "+m);
    4548            }
    46         } catch (Throwable e) {
     49        }
     50        catch (Throwable e)
     51        {
    4752            e.printStackTrace();
    4853        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette