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

octi
octi used Ask the Experts™
on
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.
Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2018
Commented:
 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.

Commented:
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...

http://java.sun.com/j2se/1.4/docs/api/java/rmi/registry/LocateRegistry.html

vemul

Author

Commented:
Hi,

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

Commented:
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

vemul

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