I wonder why. It’s actually almost as simple to run the remote object registry within the RMI server. You only have to use
java.rmi.registry.LocateRegistry#createRegistry(int port) method like this:
Registry registry = LocateRegistry.createRegistry(port); registry.bind("Foo", stub);
Here is a complete example.
This is also more efficient since you don’t have to start a separate JVM for the registry. Running the registry within the RMI server doesn’t even require an extra thread, the registry is just another remote object.
Does anyone know about any sensible reasons for using rmiregistry?