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?
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);
}
}
}