如何通过双击停止Jetty运行?

huangapple go评论69阅读模式
英文:

How to stop jetty if run by double clicking?

问题

我在Windows上安装了Jetty Java服务器。我进入了安装目录,并双击了start.jar文件。现在一个服务器在8080端口上不断监听。我需要停止这个服务器。

我在线上和文档中都查找了,最接近解决方案的是这个:

$ {jetty主目录}/ java -jar start.jar STOP.KEY=[密码] STOP.PORT=[端口] --stop

我尝试了很多次,但没有成功。也尝试过不带STOP.PORT指令和不带STOP.PASS指令,但都没有成功。显然,我需要使用启动服务器时使用的STOP.KEY。但是,因为我双击了.jar文件来运行它,我对自己到底做了什么一无所知。我已经寻找了几个小时,希望找到一些默认密码或者可以杀死的服务,任何能让我释放8080端口的方法,但都没有找到解决方案。

有一个关于如何从Eclipse中停止它的问题,但对我没有起作用。

有人知道怎么在使用双击start.jar文件启动Jetty后如何停止它吗?

英文:

I installed the jetty java server on Windows. I went to the installation directory and double-clicked on the start.jar file. Now a server is constantly listening at port 8080. I need to stop this server.

I checked both online and the documentation and the closest I've come to the solution is this:

$ {jetty home}/ java -jar start.jar STOP.KEY=[PASSWORD] STOP.PORT=[PORT] --stop

I have tried this many times but it doesn't work. Also tried without the STOP.PORT directive and without the STOP.PASS directive with no success. Apparently, I need the STOP.KEY which was used to start the server. But, as I double-clicked the .jar file to run it, I have no idea of what I have actually done. I've been looking for several hours for some sort of default password, or a service to kill, anything that allows me to free the port 8080 but I haven't found any solutions.

There is a question about how to stop it from Eclipse but didn't work for me.

Does anyone know how to kill jetty if it started double-clicking the start.jar file?

答案1

得分: 0

这不是解决方案,但如果您需要以某种方式停止该进程,则可以使用以下解决方法:

在这个问题中由 @brad-wilson 发现 how-can-you-find-out-which-process-is-listening-on-a-port-on-windows

  1. 首先,找到在该端口上运行的进程:
PS: Get-Process -Id (Get-NetTCPConnection -LocalPort <PORT>).OwningProcess
  1. 然后像这样终止它:
PS: Stop-Process -Name <PROCESS_NAME>

这应该已经释放了该端口。

英文:

This is not the solution. But it´s a workaround if you need to stop the process somehow:

Found in this question by @brad-wilson how-can-you-find-out-which-process-is-listening-on-a-port-on-windows

  1. First, find the process running on the port:
PS: Get-Process -Id (Get-NetTCPConnection -LocalPort &lt;PORT&gt;).OwningProcess
  1. Then kill it like this:
PS: Stop-Process -Name &lt;PROCESS_NAME&gt;

This should have freed the port.

huangapple
  • 本文由 发表于 2020年4月5日 01:12:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/61031811.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定