How to stop an external process that is initiate by Java?

I have a Java code and and this code triggers a batch file (if on Windows) or a shell file (if on Unix). And, this batch or shell file triggers a Perl file with some input arguments.

So, it is it is basically like this:

Java -> batch/shell -> Perl

Open in new window

what I want to do is, to be able to quit the process that is started by Java inside the Java code. This is a gui and I have a stop button for it. When I click on this button, I will initiate this stop process.

How can I stop this external process inside Java?
Who is Participating?
CEHJConnect With a Mentor Commented:
See Process.destroy
ThommyConnect With a Mentor Commented:
This should help you...
Killing a process using Java
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.