import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class HelloClient {
	public static void main(String[] args) {
		HelloInterface obj = null;
		try {
			obj = (HelloInterface) Naming.lookup("rmi://53.16.71.55:1099/HelloService");
		} catch (MalformedURLException mue) {
			mue.printStackTrace();
		} catch (RemoteException re) {
			System.err.println("Lookup error");
			re.printStackTrace();
		} catch (NotBoundException nbe) {
			System.out.println("Object not bount to registry");
			nbe.printStackTrace();
		}
		System.out.println("retrieved object's oid=" + obj);
		try {
			System.out.println(obj.sayHello());
		} catch (RemoteException re) {
			System.err.println("Error while invoking sayHello");
			re.printStackTrace();
		}
	}
}