FileDocCategorySizeDatePackage
AccountClient.javaAPI DocExample1279Wed Apr 05 11:25:42 BST 2000None

AccountClient

public class AccountClient extends Object
AccountClient: An example client for an RMI-export Account. Example pg. 45, Java Enterprise in a Nutshell, 1st ed. Author: Jim Farley

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

    try {
      System.setSecurityManager(new RMISecurityManager());

      // Lookup account object
      Account jimAcct = (Account)Naming.lookup("rmi://192.168.0.1/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 (Exception e) {
      System.out.println("Error while looking up account:");
      e.printStackTrace();
    }