Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have been following this step by step tutorial about RMI : http://www.javacamp.org/moreclasses/rmi/rmi.html

and already succeeded in compiling and run this project by using command prompt as what the tutorial has taught here : http://www.javacamp.org/moreclasses/rmi/rmi6.html

But now i am wondering, how is it if i want to create this project using Netbeans? so that i can create GUI for this project and just run it from the Netbeans IDE. Up until now, i have tried the multiple numbers of way to create it on Netbeans, but each time, the project failed to be run. please help, as i have spent about 4 days already and not yet find any solution or tutorial that can guide me through.

this is the screenshot that i got after trying to run it from Netbeans :

error

thanks in advanced!

p/s : to be clear, what i am trying to do is "to create a swing client for the RMI application that create and run the RMI invocation in Netbeans instead of commandline "

share|improve this question
Define 'failed to be run'. State why you are following a third-party tutorial in preference to the one provided with the JDK. – EJP Jun 13 at 11:40
1  
What have you tried? Do you mean you want to create a swing client or run the RMI invocation in Netbeans instead of commandline? – Nazar Annagurban Jun 13 at 11:43
whenever i tried to run the server from the netbeans, theres an error like "Server exception thrown: java.rmi.ConnectException: Connection refused to host:" . and the reason i am using the third-party tutorial is because that is the only tutorial that i have found so far that is works and i never found the one that is provided with the jdk like what you are talking about. where could i find it? thanks. – ryzalyusoff Jun 13 at 11:53
1  
It's the 'only tutorial you have found that works' and it doesn't work? – EJP Jun 13 at 11:55
oh no, what i mean is that it works when i run it using the command line, but it failed when i tried to recreate the project and run it from the Netbeans IDE. – ryzalyusoff Jun 13 at 11:59
add comment (requires an account with 50 reputation)

3 Answers

up vote 1 down vote accepted

actually, you can use both LocateRegistry.createRegistry() or just type rmiregistry in the command prompt to start the rmiregistry whenever u want to use it for netbeans project

share|improve this answer
add comment (requires an account with 50 reputation)

I have finally found the way to do this. What i need to do is start the RMIRegistry first before i run the Server. Unlike in the command prompt where i have to typr "start rmiregistry", i just have to put this line in my Server.java code in the Netbeans to start thr RMIregistry : " LocateRegistry.createRegistry(1099);" where 1099 being the port number.

enter image description here

share|improve this answer
add comment (requires an account with 50 reputation)

'Connection refused' means in this case that there was no Registry running at the indicate IP:port. So fix that, or fix the IP:port.

share|improve this answer
oh. i thought that if we run our project from Netbeans, it will start the RMIRegistry for us. could you give me reference on how to start the regitry from netbeans? thanks! – ryzalyusoff Jun 13 at 12:14
1  
Why? In production, you need to either start the rmiregistry command, or use LocateRegistry.createRegistry() from within. Why do it differently when testing? – EJP Jun 14 at 4:16
add comment (requires an account with 50 reputation)

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.