Saturday 19th August 2017,

Other Stuff

Ξ Leave a comment

Killing Web Servers in Windows

posted by steve

I’ve been having a few problems lately with the Glassfish server in Netbeans 7.2 for Windows. The server occasionally crashes out and Netbeans can’t stop it correctly so it remains in memory. This means I can’t start another instance of the server because the “Port is occupied”.

I therefore needed a quick way to kill the server from Windows (Windows 7 in my case) and here it is …

Open a command prompt and run the following …

netstat -aon | find ":80" | find "LISTENING"

This will find the process ID’s of the occupied ports and display them in the far right column of the resultant list. In my case, Glassfish is using port 8080 so I looked for the associated PID next to that port number. For me, the PID was 4268.

Then I ran the following to kill the process …

taskkill /PID 4268 /F

Actually, I first tried the command without the “/F” option and it told me that I could only terminate this process forcefully by using that option, so I did. I would advise you to try without the “/F” option first and only include it if absolutely necessary.

Thanks to the following for help with this …

Leave a Reply