1. Check the process number that occupies port 8080
netstat -aon | findstr "8080" or netstat -aon | find "8080"
Result: TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 6900
It can be seen that the process with process number 6900 occupies port 8080
You can use the command tasklist | findstr "6900" to further view the specific information of the 6900 process.
tasklist | findstr “6400” 或者 tasklist | find “6400”
Result: javaw.exe 6400 Console 0 28,792 K
It can be seen that the 6400 process is javaw.exe.
2. Kill the process
tskill
TSKILL processid | processname [/SERVER:servername] [/ID:sessionid | /A] [/V]
processid Process ID of the process to end.
processname The name of the process to end.
/SERVER:servername contains the server with processID (the default value is the current value).
When using the process name and /SERVER, you must specify /ID
or /A
/ID:sessionid to end the process running under the specified session.
/A End processes running in all sessions.
/V Display information about the operation being performed.
tskill 6400
Complete commands can also use taskkill, which is more flexible and supports termination by process name.
You can bring the parameter /F to forcefully kill the process. /PID followed by the process PID or /IM followed by the process name.
Such as: taskkill /PID 6400
Or taskkill /IM javaw