title: How do I kill a runaway Java process started by Ant?
body: <p>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.</p>
  
  <pre><code>&lt;target name="myTarget" &gt;
    &lt;java classname="path.to.MyClass" 
          fork="yes" 
          failonerror="true" 
          maxmemory="128M"&gt;
      &lt;classpath refid="run" /&gt;
    &lt;/java&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>Is there a way to link these, so that killing the ant process will kill the java process?</p>
  
  <p>I've seen the following <a href="https://stackoverflow.com/questions/7864683/how-to-kill-ant-forked-process">Q&amp;A</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.</p>