// sample client program that uses remote stack service import java.rmi.*; public class stackclient { // args[0] should be server ip public static void main(String[] args) throws Exception { // The following lines might be needed: // System.setProperty("java.security.policy","client.policy"); // System.setSecurityManager(new RMISecurityManager()); String serveraddr = args[0]; // identifies server (ip or hostname) rmistack S0, S1; S0 = (rmistack)Naming.lookup("rmi://"+serveraddr+"/stack0"); S1 = (rmistack)Naming.lookup("rmi://"+serveraddr+"/stack1"); S0.push("hello"); S0.push("world"); S1.push(S0.pop()); S1.push(S0.pop()); System.out.println(S1.pop()); System.out.println(S1.pop()); }//main } // sample usage: java stackclient 147.4.180.149