在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

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


当前回答

在Mac:

杀进程 Terminal: kill <pid>

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

来自Diego Pino的回答

其他回答

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

taskkill /F /IM 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.

在windows中

netstat -ano

将列出所有监听的协议、端口和进程。 使用

taskkill -pid "proces to kill" /f

关闭侦听该端口的进程。 如

 taskkill -pid 431 /f

如果你知道进程运行的端口是什么,你可以输入: lsof我:<端口>。

例如,lsof -i:8080列出运行在端口8080上的进程(pid)。

然后使用kill <pid>终止进程

(1)检查端口是否被使用,杀死该进程

$ lsof:[port]

(2)另一个原因是端口被ipv6使用,解决方案:

编辑/etc/sysctl.conf

将此添加到文件中

网络上。所有ipv6。在ipv6 = 1中

然后让它生效

$ sudo sysctl -p /etc/sysctl.conf

或者重启