FileDocCategorySizeDatePackage
RegistryLister.javaAPI DocExample859Sat Sep 09 21:21:52 BST 2000None

RegistryLister

public class RegistryLister extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

  
    int port = 1099;
    
    if (args.length == 0) {
      System.err.println("Usage: java RegistryLister host port");
      return;
    }
    
    String host = args[0];
    
    if (args.length > 1) {
      try {
        port = Integer.parseInt(args[1]);
        if (port <1 || port > 65535) port = 1099;
      }
      catch (NumberFormatException e) {}
    
    }
  
    String url = "rmi://" + host + ":" + port + "/";
    try {
      String[] remoteObjects = Naming.list(url);
      for (int i = 0; i < remoteObjects.length; i++) {
        System.out.println(remoteObjects[i]); 
      }
    }
    catch (RemoteException e) {
      System.err.println(e);
    }
    catch (java.net.MalformedURLException e) {
      System.err.println(e);
    }