import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class HelloClient { public static void main(String args[]) { if (args.length != 1) { System.out.println("Usage: HelloClient host"); System.exit(1); } try { String name = "Hello"; Registry registry = LocateRegistry.getRegistry(args[0]); Hello hello = (Hello) registry.lookup(name); String s = hello.sayHello(); System.out.println(s); } catch (Exception e) { System.out.println("HelloClient exception: " + e.getMessage()); e.printStackTrace(); } } }