java编程查找名字,在java(w).exe进程列表中查找.jar的名称

在公司环境中,有时需要终止一个已知会卡死的脚本。可以使用pslist列出远程计算机上的进程,然后用pskill进行杀死。但当多个Java应用程序运行时,如Eclipse、目标应用和其他java.exe进程,通过进程ID区分变得困难。为了解决这个问题,可以利用JDK提供的jps工具,结合-v选项显示额外信息(如JVM启动参数),来识别正在运行的.jar文件,从而精确结束目标进程。
摘要由CSDN通过智能技术生成

In my company environment, there's this script that runs on plenty computers and that I occasionally ask the users to kill because it's known to lock up from time to time.

I was thinking of a way to kill it myself. I've noticed I can remotely list using pslist and then killing it using pskill.

Now the problem is, when somebody's running multiple java applications (ex. Eclipse, this application, another java.exe app,...) it becomes tricky to kill the correct application in the pslist, that would look something like this:

javaw 4214 .. ...

javaw 5000 .. ...

And so on. These are different applications, but they all run from javaw.exe. Is there a way of finding out the name of the .jar they are running, so I can kill the process based on that?

解决方案

You can list java processes with

jps

or

jps -v

Jps is a tool provided with JDK and JRE, you'll find it in JDK_HOME/bin.

Option -v shows additional info (JVM start parameters)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值