// Copyright © 1998 Sun Microsystems, Inc. All Rights Reserved. // package examples.activation; import java.rmi.*; public class Client2 { public static void main(String args[]) { String server = "localhost"; if (args.length < 1) { System.out.println ("Usage: java Client "); System.exit(1); } else { server = args[0]; } try { String location = "rmi://" + server + "/MyRemoteInterfaceImpl"; MyRemoteInterface mri = (MyRemoteInterface)Naming.lookup(location); System.out.println("Got a remote reference to the newly-" + "Activatable object"); // The String "result" will be changed by the remote method call // String result = "failure"; result = (String)mri.callMeRemotely(); System.out.println("Returned from remote call"); System.out.println("Result: " + result); } catch (Exception e) { System.out.println("Exception: " + e); e.printStackTrace(); } } }