import java.rmi.*; import java.rmi.server.*; import java.io.*; public class EchoClient{ public static void main (String[] argv) { try { // Get Echo Echo echo = (Echo) Naming.lookup ("rmi://localhost/Echo"); System.out.println("Object found!"); // Use Echo BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); String userInput; while ((userInput = stdIn.readLine()) != null) { System.out.println("echo: " + echo.echo(userInput)); } } catch (Exception e) { System.out.println ("EchoClient exception: " + e); } } }