import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;


public class HelloClient {

    private HelloClient() {}

    public static void main(String[] args) {
        String host = (args.length < 1) ? null : args[0];

        try {
            Registry registry = LocateRegistry.getRegistry(host);
            HelloInterface remoteObj = (HelloInterface) registry.lookup("Hello");

            String response = remoteObj.sayHello(); // actual RMI
            
            System.out.println("response: " + response);
        } catch (Exception e) {
            System.err.println("Client exception: " + e.toString());
            e.printStackTrace();
        }
    }
}
