This Java tips illustrates a method of looking up a remote object and invoking a method. Developer may first check for the availability of the remote object and then in case remote object exist, its method is invoked.

 try {
    // Look up a remote object
    RObject robj = (RObject) Naming.lookup("//localhost/RObjectServer");
    // Invoke method on remote object
} catch (MalformedURLException e) {
} catch (UnknownHostException e) {
} catch (NotBoundException e) {
} catch (RemoteException e) {

Parent Category: Java SE Tips