After I stop the server, and exit the console, if I want to restart the server again, I got the following error: "Port already in use." Does that mean rmi registry still listen on the port (I use the default port)? How can I fix this?
hi, I have encounted the same problem. I fixed it by adding the code:System.exit(0). I don't know the exact reason. I guess, the stop server is not exit the server, so the port still be used. Am I right?
Hello, The RMI Registry is a seperate process basically it binds to a port (1099) by default. Your Java program (the Server) looks up on the Registry to retrieve an object but other than that it has nothing to do with the registry. There is no reason for the registry to die just because your Java program terminates. You will need to kill the RMI Registry and the exit the server program every time you wish to re-run. Alternatively I would have thought you can get away with leaving the RMI Registry running but just restarting the Java server. So use this first time: rmiregistry & java -jar -server.jar & Then just use: java -jar -server.jar & Good luck Ian
Thanks guys. Ying: where did you put System.exit(0)? Since your server always runs. Did you provide a gui for your server? Ian: That is what I am thinking, its just a bit too restrictive. [ July 14, 2002: Message edited by: Holmes Wong ]