RMI server: rmiregistry or LocateRegistry.createRegistry

Randy Sugianto 'Yuku' picture Randy Sugianto 'Yuku' · Sep 19, 2008 · Viewed 12.7k times · Source

For RMI on server-side, do we need to start rmiregistry program, or just call LocateRegistry.createRegistry? If both are possible, what are the advantages and disadvantages?

Answer

user17250 picture user17250 · Sep 19, 2008

They're the same thing... rmiregistry is a separate program, which you can run from a command line or a script, while LocateRegistry.createRegistry does the same thing programatically.

In my experience, for "real" servers you will want to use rmiregistry so that you know it's always running regardless of whether or not the client application is started. createRegistry is very useful for testing, as you can start and stop the registry from your test as necessary.