如何在Java中查找并终止运行Win-Processes? [英] How to find and kill running Win-Processes from within Java?
本文介绍了如何在Java中查找并终止运行Win-Processes?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一种Java方法来查找正在运行的Win进程,我知道可执行文件的名称。我想看看它是否正在运行,如果我找到它,我需要一种方法来终止进程。
I need a Java way to find a running Win process from which I know to name of the executable. I want to look whether it is running right now and I need a way to kill the process if I found it.
推荐答案
你可以使用命令行窗口工具任务列表
和 taskkill
并使用从Java调用它们Runtime.exec ()
。
You can use command line windows tools tasklist
and taskkill
and call them from Java using Runtime.exec()
.
这篇关于如何在Java中查找并终止运行Win-Processes?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文