import java.rmi.*; public class Client { public static void main(String[] args) { String url = "rmi://localhost/"; try { RemoteServer remoteServer = (RemoteServer) Naming.lookup(url + "server"); System.out.println(remoteServer.getString()); } catch(Exception e) { System.out.println("Exception generated: "+ e.getMessage()); } } }