I am running an external program that runs next to Java using this:
Process p = Runtime.getRuntime().exec("/path/to/binary");
When I stop the Java application, the external program continues to work, but I also want this to stop too.
To start shutdown, you can add the shutdown application to it. See Runtime.addShutdownHook () .
To shutdown, you can either pass a request to cease grace to an external process, or call Process.destroy ()
use shutdown: http://download.oracle.com/javase/1.4.2/docs/guide/lang/hook-design.html