I am running a Java application that shall start an external command line application in a new Window. I would like the Java Application to terminate afterwards and the external application to remain open. However, with my current approach, the Java application terminates not before I terminate the external application. Here is my code:
Then the start() method is blocking. Try immediately reading the stdin and stderr streams after invocing start(). From the java.lang.Process API documentation:
By default, the created subprocess does not have its own terminal or console. All its standard I/O (i.e. stdin, stdout, stderr) operations will be redirected to the parent process, where they can be accessed via the streams obtained using the methods getOutputStream(), getInputStream(), and getErrorStream(). The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, or even deadlock.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
When trying to create the thread dump, I figured out that the Java application is terminating when I start it from a command window. Before, I always started it from eclipse. So, I guess it has something to do with the combination of calling cmd, start and the external application. So, how can I solve that my Java application also terminates when being started from eclipse?
jps -l lists only two processes: sun.tools.jps.Jps and eclipse\\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar . The thread dump of the latter is attached.