How to set port free which is assigned to a certain process/application? This tutorial shows how to kill the port at Windows operation system.
At my development machine, I got into trouble with my Spring Boot application. My local Spring development environment could not run because the application port was occupied. By default, Spring is using port 8443. I needed to make port free in order to run my application without the need of rewriting port number in the application config file.
Here is a simple solution on how to set occupied port free at Windows OS:
You have to run the Windows Command Line as an Administrator or Git Bash. Then run the command below with port number in port number placeholder.
netstat -ano | findstr :MY_PORT_NUMBER
The number on the right side (PID – process identifier) is the number of processes currently using the port.
For this, you can use only the Windows Command Line. You need to kill the process using the port so the port can be set free. Type following command with process PID.
taskkill /PID YOUR_PID_NUMBER /F
Prefix /F in this case means forcefully terminates the process.
If everything went smoothly, you should get the following message:
SUCCESS: The process with PID YOUR_PID_NUMBER has been terminated.
In the end, rerun the first command to check if the process is on or not. If you get an empty line, the process successfully ended, and the required port is free.