从Windows 7中的命令行强制杀死JVM [英] Kill JVM not forcibly from command line in Windows 7

查看:927
本文介绍了从Windows 7中的命令行强制杀死JVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我让Cobertura检测了jar在JVM中运行。当我在运行应用程序的Windows控制台中按Ctrl-C时,JVM结束并且 Cobertura结果成功刷新到cobertura.ser文件。但是我需要使用命令/工具(不是Ctrl-C)来停止这个JVM,比如Linux中的软杀(kill命令没有-9参数)。当我使用taskkill / PID 1234时,它写道:

I have Cobertura instrumented jar running in JVM. When I press Ctrl-C in Windows console, where application runs, JVM ends and Cobertura results are successfully flushed to cobertura.ser file. But I need stop this JVM with command/tool (not Ctrl-C), something like "soft kill" in Linux ("kill" command without "-9" parameter). When I use "taskkill /PID 1234", it writes:

D:\>taskkill /PID 1234
ERROR: The process with PID 1234 could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).

但是当我使用参数/ F时,强制终止JVM,这就是 Cobertura结果的原因没有刷新到cobertura.ser文件

But when I use parameter /F, JVM is terminated forcibly and that is why Cobertura results are not flushed to cobertura.ser file.

如何使用Windows命令/第三方工具杀死JVM并成功进行Cobertura刷新(windows软杀) ?

How to kill JVM using Windows command/third party tool with successful Cobertura flush (windows "soft kill")?

推荐答案

试试看 WMI ,使用JavaScript或VBScript创建选择流程并将其删除的规则。

Try look at WMI, using JavaScript or VBScript you create rules for selecting process and killing it.

例如 http:// community.spiceworks.com/scripts/show/498-kill-a-process-using-wmi - 使用VBScript登记简单的kill脚本

For example http://community.spiceworks.com/scripts/show/498-kill-a-process-using-wmi - enlist simple kill script using VBScript

这篇关于从Windows 7中的命令行强制杀死JVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆