-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.

Rohith
  • 1
  • 1

1 Answers1

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).

The_Programmer
  • 186
  • 3
  • 12
  • 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. – Rohith Nov 10 '17 at 08:52