HRServer.java (592B)
1 import java.rmi.registry.Registry; 2 import java.rmi.registry.LocateRegistry; 3 import java.rmi.RemoteException; 4 import java.rmi.server.UnicastRemoteObject; 5 6 public class HRServer extends HRImpl { 7 public static void main(String[] args) { 8 try { 9 HRImpl impl = new HRImpl(); 10 HRInterface stub = (HRInterface)UnicastRemoteObject.exportObject(impl, 0); 11 Registry reg = LocateRegistry.getRegistry(); 12 13 reg.bind("HRRegistry", stub); 14 System.out.println("server ready"); 15 } catch (Exception e) { 16 System.err.println("server exception: " + e.toString()); 17 e.printStackTrace(); 18 } 19 } 20 }