Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I terminate a subprocess?

807580May 20 2010 — edited May 22 2010
I'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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2010
Added on May 20 2010
14 comments
652 views