如何确保某个端口不被任何其他进程占用 [英] How to make sure that a certain Port is not occupied by any other process
问题描述
我正在 Windows 环境中开发 Java EE 应用程序.(我使用的是 Windows 7)
I am working on a Java EE Application in a Windows environment. (I am using Windows 7)
我正在使用 Tomcat 服务器,不幸的是端口号 8080 正忙(由 Oracle 使用).现在我想给Tomcat分配一个不同的端口.
I am using Tomcat Server, unfortunately port number 8080 is busy (used by Oracle). Now I want to assign a different port to Tomcat.
因此,在更改 conf/server.xml 文件之前,我想确保某个端口没有被任何其他进程占用并且是免费的.
So before changing inside conf/server.xml file, I want to make sure that a certain port is not occupied by any other process and it's free.
推荐答案
您可以使用netstat"来检查端口是否可用.
You can use "netstat" to check whether a port is available or not.
使用 netstat -anp |find "端口号"
命令用于查找端口是否被另一个进程占用.如果它被另一个进程占用,它会显示该进程的进程ID.
Use the netstat -anp | find "port number"
command to find whether a port is occupied by an another process or not. If it is occupied by an another process, it will show the process id of that process.
你必须在端口号之前加上 : 才能得到实际的输出
前netstat -anp |找到:8080"
这篇关于如何确保某个端口不被任何其他进程占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!