/*
 * implement RMI SmallPrime example
 *
 */

import java.net.*;
import java.rmi.*;

public class ex21s {

  public static void main(String[] args) 
         throws InterruptedException {

    SmallPrimeImpl sp = null;
    String name = "SmallPrime";

    try { sp = new SmallPrimeImpl(); }
    catch (RemoteException re) {
      System.err.println("Can not create " + name + " implementation.");
      System.exit(-1);
      } 

    try { Naming.rebind(name, sp); }
                        // do not use full URL: "rmi://localhost/" 
    catch (MalformedURLException u) {
      System.err.println("MalformedURL in Namin.rebind." + u);
      System.exit(-1);
      } 
    catch (RemoteException re) {
      System.err.println("cannot contact local registry." + re);
      System.exit(-1);
      } 

    System.out.println("method registered");

  }

}




