-1

I want to terminate running java application from other java application. can you provide me some idea how to kill / terminate application. example: java application A is running. I want to terminate it by other java application say B.

1
  • I think that it is OS-Specific. Please, describe more about the system and your code that you've tried so far. Commented Nov 9, 2017 at 10:46

1 Answer 1

0

First launch java app B, and start your application A using B. Use Runtime.exec(String) or a ProcessBuilder to start A and store the returned Process object in a variable.

If you now want to kill the subprocess A created by B, use Process.destroy() or Process.destroyForcibly() (whatever fits better).

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the answer. In the above example java app B starts app A. I want know is there any way to terminate the java app B (automatic or manually) after it starts app A.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.