Java:检查哪些进程绑定到端口?
我正在 Netbeans 中开发一个应用程序,它使用 JavaDB。我可以连接到它并毫无问题地执行查询,但由于某种原因,Netbeans 中的“输出 - JavaDB 数据库进程”窗格不断显示
Security manager installed using the Basic server security policy.
Could not listen on port 1527 on host localhost:
java.net.BindException: Address already in use
如何找出正在使用的进程,或绑定到该端口?
在 Ubuntu Karmic、Netbeans 6.7.1 上
I am developing an application in Netbeans, and it is using JavaDB. I can connect to it and execute queries without issues, but for some reason, the "Output - JavaDB Database Process" pane within Netbeans keeps displaying
Security manager installed using the Basic server security policy.
Could not listen on port 1527 on host localhost:
java.net.BindException: Address already in use
How do I find out what process is already using, or bound to that port?
On Ubuntu Karmic, Netbeans 6.7.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要查找侦听端口 1527 的进程的 pid,请使用:
或
然后:
我很确定您会找到与 JavaDB 对应的 Java 进程的 pid(我不知道很多进程)除了 JavaDB 之外,还使用端口 1527)。你实际上是如何开始的?
PS:我正在使用 JavaDB,它是在任何 IDE 之外的命令行上启动的。
To find the pid of a process listening to the port 1527, either use:
or
And then:
And I'm pretty sure that what you'll find is the pid of a Java process corresponding to JavaDB (I don't know many processes using port 1527 apart from JavaDB). How did you actually start it?
PS: I'm using JavaDB that I'm starting on the command line, outside any IDE.
两个可以帮助您的程序是“lsof”和“netstat”,它们都可以提供此信息。我会给你打电话的理由,但我用我的超大 iPhone 来接听,查找起来太麻烦了。所以这留给读者作为练习;-)
Two programs that would help you out are ‘lsof‘ and ‘netstat‘ both of which can provide this information. I would give you the arguments to call them with but I am using my oversized iPhone to answer and it is too cumbersome to look up. So that is left as an exercise for the reader ;-)