在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

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


当前回答

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

你可以尝试杀死一个运行在你的任务管理器中的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.

在Mac:

杀进程 Terminal: kill <pid>

找到pid: 终端:lsof -i:<端口>

来自Diego Pino的回答

是的,您有另一个进程绑定到相同的端口。

当我遇到JVM_BIND错误时,Windows Sysinternals中的TCPView(仅限Windows)是我最喜欢的应用程序。它显示了哪个进程正在侦听哪个端口。它还提供了一个方便的上下文菜单来终止进程或关闭妨碍进程的连接。

您需要关闭端口 如果您是Linux用户,请输入

fuser -k 8080/tcp

你可以关闭所有的Java进程,然后重新启动你的应用程序:

taskkill /F /IM java.exe

再次启动应用程序…