/** @version 1.01 2001-07-10 @author Cay Horstmann */ import java.rmi.*; // RMISecurityManager() import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; /** This program demonstrates how to call a remote method on two objects that are located through the naming service. */ public class ProductClient { public static void main(String[] args) { System.setProperty("java.security.policy", "client.policy"); System.setSecurityManager(new RMISecurityManager()); String host = (args.length < 1) ? null : args[0]; // args[0] debe ser la máquina try { Registry registry = LocateRegistry.getRegistry(host); Product stub1 = (Product)registry.lookup("toaster"); Product stub2 = (Product)registry.lookup("microwave"); System.out.println(stub1.getDescription()); System.out.println(stub2.getDescription()); } catch(Exception e) { System.err.println("Client Exception: " + e.toString()); e.printStackTrace(); } } }