Kill process/port on MAC machine in case of java.net.BindException: Address already in use

  • First try netstat –
    netstat -vanp tcp | grep <PORT Number(8061)>

    Result

    tcp46      0      0  *.8061                 *.*                    LISTEN      131072 131072  71666      0

  • The Find the PID for the locking port –
    lsof -i :<PORT Number(8061)>
    

    Result

    COMMAND   PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME

    java    71666 tangupta   90u  IPv6 0x9f73e601cf2fbd79      0t0  TCP *:8061 (LISTEN)

  • Kill:
    kill -9 <PID(71666)>

Result – Process running on the above port would be killed. Now you can resume your           work on the above port which was blocked.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s