Let's say my main program is contained in main.jar. What I want to do is start a program such as an executable or a batch file and be able to close main.jar while the other program is running. I've included a basic example of what I'm trying to do:
However, when I run this the program waits for notepad to be closed. What I would want in this basic example is for the java program to end and notepad be left open for it to be used. Any help would be greatly appreciated.
This code will cause your application to terminate:
posted 10 years ago
Paul Clapham wrote:This code will cause your application to terminate:
When I add that after the "Runtime.exec" it doesn't exit my app. It waits for the notepad window to close. I have also tried creating a new thread before opening notepad and it doesn't help either. The second thread finishes but the java program continues to run until the notepad window is closed.
The result of runnign the code is:
The program then continues to run until the notepad window is closed. After that the java program exits without printing the "stop" line, which is to be expected.