Listing B
public class SimpleRMIServer
{
  public static void main(String args[])
  {
    if (System.getSecurityManager() == null)
    {
      System.setSecurityManager(new RMISecurityManager());
    }
 
    try
    {
      TimeKeeperImpl obj = new TimeKeeperImpl();
 
      // Bind this object instance to the name "TimeKeeper"
      Naming.rebind("//myhost/TimeKeeper", obj);
 
      System.out.println("TimeKeeper is bound in the registry");
    }
    catch (Exception e)
    {
      System.out.println("error: " + e.getMessage());
      e.printStackTrace();
    }
  }
}