Skip to Main Content

Java SE (Java Platform, Standard Edition)

Executing jar from java code, then kill parent java code

843810Jun 22 2010
Please suggest if there is any best way around on executing jar from java code then killing parent java code.

a) I have desktop based java application say "" which runs every 5 minutes.

b) How can I START external java application say "execute.jar" from THEN EXIT

I tried various options using "ProcessBuilder" and calling bat file but I need Monitor (parent application to EXIT, immediately after calling child (execute.jar)

Try1) ProcessBuilder builder = new ProcessBuilder("java -jar execute.jar");
Process process = builder.start();
Try2) Runtime r = Runtime.getRuntime();
Process p = null;
p = r.exec(new String[] { "cmd", "/c", "start C:/temp/Test.bat" });
Post Details
Locked on Jul 20 2010
Added on Jun 22 2010