Reputation: 20360
I am writing a simple JAR application in IntelliJ. When I debug it for the first time, it works without any problem. But when I try to debug a second time, I get this annoying message:
Unable to open debugger port (127.0.0.1:56568): java.net.BindException "Address already in use"
If I wait for sometime and then try again, it works. Is there any way I can fix this?
Upvotes: 3
Views: 7555
Reputation: 117
If you are using Windows:
Type
netstat -a -o -n
Search on the result list on column Local Address the port 56568
taskkill /F /PID 1234
Upvotes: 2
Reputation: 81104
Typically this happens because you haven't closed your previous debugging/run instance before starting the next one. The debugger will use a TCP port that you specify, and ports are exclusive: you cannot have two processes that bind to the same port.
In IDEA 14+, you can mark a Run Configuration as "Single instance only". This will ensure that the previous process is stopped if you (accidentally) run it while the previous instance was still running.
Upvotes: 2