import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class HelloServer
	extends UnicastRemoteObject
	implements HelloInterface {

	protected HelloServer() throws RemoteException {
		super();
		try {
			Naming.rebind("rmi://localhost:1099/HelloService", this);
		} catch (RemoteException re) {
			re.printStackTrace();
		} catch (MalformedURLException mue) {
			mue.printStackTrace();
		}
	}

	public static void main(String argv[]) throws RemoteException {
		new HelloServer();
	}

	public String sayHello() throws RemoteException {
		return (new String("Hello world!"));
	}
}
