Can I start the rmi registry form my Java application using rmi?

octi used Ask the Experts™
I would like to start the RMI registry when my application will start. It would be very nice if it could be done from the application itself.
Is that possible, considering the restrictions about classpath? (RMI registry should not find any class in the classpath that will be used, because it will ignore the codebase parameter of the JVM and dynamic code downloading will not work)
Other solutions are also welocome, like starting the RMI registry from an application starter script file, some *.sh for e.g. under linux.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2018
 Have you tried:

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("rmiregistry");

  You must be in the directory that contains the classes you have written.

  Hope it helps.

I know this question is closed but I just wanted to inform you of another solution, if you are interested in using java packages.

You can use LocateRegistry to start the registry for ex:
Registry reg = java.rmi.registry.LocateRegistry.createRegistry(2002);

and then you call rebind on reg.

Check this out for more info...




Yes, this is the best solution! Thanks.
Sorry for the points -:((

oh no.. that's fine.. this is a place where we exchange ideas and I want to make sure you get the best of it from this site


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial