In "C", I can run a long blocking process in the background (AND HAVE IT CONTINUE TO RUN) after the starting process has exited.
void main(void)
{
system("some_long_blocking_process &");
exit();
}
// "some_long_blocking_process" is still running here (DESIRED BEHAVIOR)
Java's getRuntime().exec() DOESN'T have this behavior. Instead, "some_long_blocking_process" ends immediately when the Java process ends.
Anyone know how I can recapture this behavior in Java?
- I am using Java 1.4 (No process builder)
- I specifically am looking to start the long blocking process and to exit immediately (no "waitFor(), etc.)
- Things I have already tried (the process runs correctly, but I still get the same undesired behavior)
- adding "nohup" and run in foreground ("nohup some_long_process")
- adding "nohup" and running in background ("nohup some_long_process &")
- run in foreground ("some_long_process")
- run in background ("some_long_process &")
THANKS!
Thanks to all the suggestions... I've decided to use jtahlborn's answer (it worked for me)