I have written java programs for Client and Server. But, to run the program I need to start rmi registry manually! How to start RMI registry through java code (through Server)?
Asked
Active
Viewed 2.0k times
2 Answers
16
-
Used LocateRegistry.createRegistry(6302); not working i m getting Connection refused to host: xxx.xxx.x.x; – Andy May 04 '12 at 10:50
-
1@Andy No, you're not. Either you're not calling `LocateRegistry.createRegistry(),` or you're not getting that exception when you do. I suspect you're getting that exception *in your client.* – user207421 May 04 '12 at 10:53
-
I wrote this in server! I want RMI registry to be started when the server executes! – Andy May 04 '12 at 10:55
-
4@Andy `LocateRegistry.createRegistry()` cannot possibly throw 'connection refused'. It doesn't try to create any connections. You are omitting some vital information here. – user207421 May 04 '12 at 12:15
-
@Aniket what happened in the end? – CodyBugstein Oct 01 '15 at 04:01
-1
First, you need execute in java bin folder "start rmiregistry" throught shell/command line (create CLASSPATH system var to java class/jar to the project to register in RMI Register, RMI Registry need know their classes).
Before you can use LocateRegistry.getRegistry().

Dani
- 4,001
- 7
- 36
- 60