解决端口占用问题
windows查看端口占用
1.在windows命令行窗口下执行:
netstat -aon|findstr "8080"
TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 8136
端口“8080”被PID(进程号)为8136的进程占用。
2. 查看端口“8080”被哪个应用占用,,继续执行下面命令:
tasklist|findstr "8136"
3.进程被终止
C:\Windows\system32>netstat -ano|findstr 8080
TCP 127.0.0.1:8080 0.0.0.0:0 LISTENING 8136
C:\Windows\system32>taskkill /f /pid 8136
成功: 已终止 PID 为 8136 的进程。
linux系统
方法1 使用lsof命令
使用IPv4协议的局域网:
执行命令: lsof -Pnl +M -i4|grep 8080
输出结果: java 1419 1401 10u IPv4 6793357 TCP *:8080 (LISTEN)
方法2 先使用 netstat命令,再用 ps命令
执行命令: netstat -anp|grep 8080
输出结果: tcp 0 0 :::8080 :::* LISTEN 12006/java
执行命令: ps -ef | grep 12006
输出结果: root 12886 12851 0 Dec09 ? 00:01:14 /home/bjca/bea/jdk160_05/bin/java -client -Xms256m -Xmx512m -XX:Compile
还没有评论,来说两句吧...