morpheus
morpheus

Reputation: 20360

IntelliJ keeps displaying annoying message: Unable to open debugger port (127.0.0.1:56568): java.net.BindException "Address already in use"

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

Answers (2)

Trony Tr
Trony Tr

Reputation: 117

If you are using Windows:

  1. Open CMD
  2. Type

    netstat -a -o -n

  3. Search on the result list on column Local Address the port 56568

  4. Look to the right on column PID for its process ID, for example: 1234
  5. Type

    taskkill /F /PID 1234

Upvotes: 2

Mark Peters
Mark Peters

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

Related Questions