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)
{
sy
Your problem is probably due to the trailing &. Try removing it.
getRuntime().exec()
is more similar to fork()
and exec()
than system()
.
system() passes the command to the shell, and it's Bash that understands that the trailing ampersand means to run the process in the background.
getRuntime().exec() parses the command using a StringTokenizer to parse the command, and doesn't do anything with the trailing ampersand. That's simply passed as the first argument to your some_long_blocking_process
, which may exit out immediately on the unknown error.