port

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


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?


Solution

  • 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