/* 02222: Java RMI Tutorial */ import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class SystemInfoServer implements SystemInfo { public SystemInfoServer() {} public String getSystemInfo(String systemProperty) { return System.getProperty(systemProperty); } public static void main(String args[]) { try { SystemInfoServer obj = new SystemInfoServer(); SystemInfo stub = (SystemInfo) UnicastRemoteObject.exportObject(obj, 0); // Bind the remote object's stub in the registry Registry registry = LocateRegistry.getRegistry(); registry.bind("SystemInfo", stub); System.err.println("SystemInfoServer ready"); } catch (Exception e) { System.err.println("SystemInfoServer exception: " + e.toString()); e.printStackTrace(); } } }