How do I terminate a subprocess?
807580May 20 2010 — edited May 22 2010I'm making a personal front end to a command line interface application (FFMpeg), and I create the subprocess using Runtime.getRuntime().exec("cmd.exe"). The task of the process is a video encode. However, I'm not sure about how I should go about canceling the subprocess task when I click on the cancel button. When run from the command line, the CLI app can be canceled by pressing the 'q' key, but from what I've read, there is no easy way to send the CLI app a key event from Swing. I've also tried using the process.Destroy() method, but the app keeps chugging away in the background.
How should I go about this "canceling" the task? Is it safe to just "tskill" it?