我如何杀死蚂蚁通过启动一个失控的Java进程? [英] How do I kill a runaway Java process started by Ant?

查看:210
本文介绍了我如何杀死蚂蚁通过启动一个失控的Java进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我从一个Ant脚本开始分叉的java程序,并杀死蚂蚁的过程,它不会杀死Java进程。这是无论从IDE或从命令行运行它的情况。

If I start a forked java process from an ant script and kill the ant process, it does not kill the java process. This is the case whether running it from the IDE or from the command line.

<target name="myTarget" >
  <java classname="path.to.MyClass" 
        fork="yes" 
        failonerror="true" 
        maxmemory="128M">
    <classpath refid="run" />
  </java>
</target>

有没有办法来链接这些,使查杀蚂蚁过程会杀死java程序?

Is there a way to link these, so that killing the ant process will kill the java process?

我已经看到下面的 Q&安培; A - 但这似乎把重点放在如何手动杀掉java进程。我不想这样做,因为我有一些其他的Java应用程序运行,并寻找合适的ja​​va.exe进程,任务管理器杀并不总是直线前进。

I've seen the following Q&A - but this seems to focus on how to kill the java process manually. I don't want to do this, because I have a number of other java applications running, and finding the right java.exe process to kill in TaskManager is not always straight forward.

推荐答案

不幸的是,看起来,这是一个长期和已知问题。

Unfortunately, it appears that this is a long-standing and known issue.

在Ant任务终止时,派生的Java程序关闭挂钩不会被触发。 (这似乎已经起了一个问题的Java 1.4(!))

When the Ant task is terminated, the forked Java process shutdown hooks are not fired. (This seems to have been an issue since Java 1.4 (!))

有关参考:


  • 蚂蚁bug报告

  • 的Java不是-A-bug报告

  • an Ant bug report
  • a Java not-a-bug report

这篇关于我如何杀死蚂蚁通过启动一个失控的Java进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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