java.net.BindException: Address already in use (Bind failed)


java.net.BindException: Address already in use (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.(ServerSocket.java:237)
at java.net.ServerSocket.(ServerSocket.java:128)

at TestSocket$ServerSocketThread.run(TestSocket.java:48)


mac:

ps -e | grep Test,这里的Test是项目的名字,因为我的项目名字是Test,例如获取到了pid 得到了2222

kill 2222 去杀掉这个进程


Window:(参考:http://blog.csdn.net/gaojinshan/article/details/17333073)

使用ipconfig,查看本机的IP(192.168.1.105),然后,使用如下命令看看是谁绑定了该IP:
netstat -no | findstr "192.168.1.105"
然后,使用如下的命令,终止绑定该IP的进程:
taskkill /f /pid 7196



你可能感兴趣的:(开发中遇到的问题解决,TroubleShooting)