ubuntudroid
ubuntudroid

Reputation: 3999

Observer RMI registry via command line

I'm currently starting to work with Java RMI and want to look at what bindings my local RMI registry (started by rmiregistry & from shell) offers after I've bound my server stubs. Is there a simple way to query all offered bindings from command line?

Upvotes: 2

Views: 6222

Answers (1)

dogbane
dogbane

Reputation: 274612

The rmiregistry command does not allow you to view the registry. Instead you can write a simple java program to do this. For example:

public class RegistryViewer {
  public static void main(String... args){
    String host = args[0];
    int port = Integer.parseInt(args[1]);
    Registry registry = LocateRegistry.getRegistry(host, port);
    for (String name : registry.list()) {
        System.out.println(name);
    }
  }    
}

Upvotes: 7

Related Questions