在Eclipse中,我得到了这个错误:

run:
     [java] Error creating the server socket.
     [java] Oct 04, 2012 5:31:38 PM cascadas.ace.AceFactory bootstrap
     [java] SEVERE: Failed to create world : java.net.BindException: Address already in use: JVM_Bind
     [java] Java Result: -1
BUILD SUCCESSFUL
Total time: 10 seconds

我不知道为什么现在出现了,但几个小时前它运行得很好。我需要重新启动我的机器吗?我该怎么查到底呢?感谢您的建议和建议。


当前回答

I faced similar issue in Eclipse when two consoles were opened when I started the Server program first and then the Client program. I used to stop the program in the single console thinking that it had closed the server, but it had only closed the client and not the server. I found running Java processes in my Task manager. This problem was solved by closing both Server and Client programs from their individual consoles(Eclipse shows console of latest active program). So when I started the Server program again, the port was again open to be captured.

其他回答

(Windows)

要终止一个进程,首先需要找到进程Id (pid)

通过运行命令:

netstat -ano | findstr :yourPortNumber

你会得到你的进程Id (PID),现在要杀死相同的进程运行这个命令:

taskkill /pid yourid /f

重新启动电脑一次,我想它会工作。它开始在我身上起作用。还有一件事可以做,进入任务管理器并结束该过程。

您在同一端口上运行另一个进程。

你可以尝试杀死一个运行在你的任务管理器中的java.exe服务- ps确保你没有杀死eclipse,因为它也被列为java.exe。如果其他方法都不起作用,重新启动机器无论如何都会修复它。看起来你没有关闭之前测试中的套接字。希望这能有所帮助。

I faced similar issue in Eclipse when two consoles were opened when I started the Server program first and then the Client program. I used to stop the program in the single console thinking that it had closed the server, but it had only closed the client and not the server. I found running Java processes in my Task manager. This problem was solved by closing both Server and Client programs from their individual consoles(Eclipse shows console of latest active program). So when I started the Server program again, the port was again open to be captured.

对于那些正在寻找最简单的答案的人(因为这是我们通常错过的),只需停止您正在运行的项目并重新开始。 大多数情况下,我们所做的是忘记停止我们之前运行的项目,当我们重新运行项目时,它会显示这样的问题。

我还附上了一张照片,让它更清晰(我使用“Spring工具套件”)。 所以你需要做的是点击最右边的按钮,如果你想重新启动同一个项目,或者首先点击右边第二个按钮来停止你的项目,然后点击最左边的按钮来运行你的项目。我希望这将解决少数新程序员的问题。:)