try {
System.setSecurityManager(new RMISecurityManager());
// Lookup account object
Account jimAcct = (Account)Naming.lookup("rmi://localhost/JimF");
// Make deposit
jimAcct.deposit(12000);
// Report results and balance.
System.out.println("Deposited 12,000 into account owned by " +
jimAcct.getName());
System.out.println("Balance now totals: " + jimAcct.getBalance());
}
catch (RemoteException re) {
System.err.println("Remote exception while looking up account: "
+ re.getMessage());
}
catch (NotBoundException nbe) {
System.err.println("Server object not found at expected URL: "
+ nbe.getMessage());
}
catch (MalformedURLException mue) {
System.err.println("Bad RMI URL given for server object: "
+ mue.getMessage());
}