1 package client;
2
3 import java.io.InputStreamReader;
4 import java.io.BufferedReader;
5 import common.RemoteBank;
6 import java.rmi.Naming;
7
8 import org.jstk.example.bank.client.BankClient;
9
10public class RMIBCShell {
11 public static void main(String[] args) throws Exception {
12 BankClient bc = new BankClient();
13 RemoteBank rbank = (RemoteBank)Naming.lookup("rmi://" + args[0] + "/" + "MyRemoteBank");
14 bc.init(new BankProxy(rbank));
15 while (true){
16 System.out.print("rbcsh>");
17 System.out.flush();
18 String cmdline = new BufferedReader(new InputStreamReader(System.in)).readLine();
19 String[] cmdargs = cmdline.split("\\s");
20
21 String result = bc.execCommand(cmdargs);
22 System.out.println(result);
23 }
24 }
25}