/* 02222: Java RMI Tutorial */ import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class SystemInfoClient { private SystemInfoClient() {} public static void main(String[] args) { String serverHost = (args.length < 2) ? null : args[0]; String systemProperty = (args.length < 2) ? args[0] : args[1]; try { Registry registry = LocateRegistry.getRegistry(serverHost); SystemInfo systemInfo = (SystemInfo) registry.lookup("SystemInfo"); String response = systemInfo.getSystemInfo(systemProperty); System.out.println("\nServer answer: " + systemProperty + " is " + response + "\n"); } catch (Exception e) { System.err.println("SystemInfoClient exception: " + e.toString()); e.printStackTrace(); } } }