FileDocCategorySizeDatePackage
Client2.javaAPI DocExample2610Wed Apr 19 11:20:24 BST 2000examples.activation

Client2

public class Client2 extends Object

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


	String server = "localhost";
	if (args.length < 1) {
	    System.out.println ("Usage: java Client <rmihost>");
	    System.exit(1);
	} else {
	    server = args[0];
	}

	// Set a security manager so that the client can 
	// download the activatable object's stub
	//
	System.setSecurityManager(new RMISecurityManager());

	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();
	}