001package headfirst.proxy.gumball;
002import java.rmi.Naming;
003
004public class GumballMachineTestDrive {
005
006        public static void main(String[] args) {
007                GumballMachineRemote gumballMachine = null;
008                int count;
009
010                if (args.length < 2) {
011                        System.out.println("GumballMachine <name> <inventory>");
012                        System.exit(1);
013                }
014
015                try {
016                        count = Integer.parseInt(args[1]);
017
018                        gumballMachine =
019                                        new GumballMachine(args[0], count);
020                        Naming.rebind("//" + args[0] + "/gumballmachine", gumballMachine);
021                } catch (Exception e) {
022                        e.printStackTrace();
023                }
024        }
025}