String host = argv[0];
String name = argv[1];
try {
// Set the RMI security manager, in case we need to load remote classes
System.setSecurityManager(new RMISecurityManager());
// Lookup activatable object
ThisOrThatServer server =
(ThisOrThatServer)Naming.lookup("rmi://" + host + "/" + name);
System.out.println("Got server");
System.out.println(server.doThis("something"));
}
catch (Exception e) {
System.out.println("Error while looking up server:");
e.printStackTrace();
}