Find the PID of a process that uses a port on Windows

Thomas picture Thomas · Apr 11, 2013 · Viewed 277.2k times · Source

My service crash on startup with the classic:

java.rmi.server.ExportException: Listen failed on port: 9999

How can I find the process for killing it?

Answer

Thomas picture Thomas · Apr 11, 2013

Just open a command shell and type (saying your port is 123456):

netstat -a -n -o | find "123456"

You will see everything you need.

The headers are:

 Proto  Local Address          Foreign Address        State           PID
 TCP    0.0.0.0:37             0.0.0.0:0              LISTENING       1111