Samples JDK
AdditionServer.java
1 package com.freemindcafe.rmi.sample3.server;
2 
3 import java.rmi.registry.LocateRegistry;
4 import java.rmi.registry.Registry;
5 
6 public class AdditionServer {
7 
8  public static void main(String[] args) throws Exception{
9  Addition Hello = new Addition();
10  Registry registry;
11  try {
12  registry=LocateRegistry.getRegistry(9999);
13  registry.list();
14  }
15  catch (Exception e) {
16  registry=LocateRegistry.createRegistry(9999);
17  registry.list();
18  }
19  registry.bind("rmi://localhost/rmi-sample3", Hello);
20  System.out.println("Addition Server is ready.");
21  }
22 
23 }