Search code examples
javacfork

Java - C-Like Fork?


Is it possible to do a "C like" fork in java, using an new independent jvm process ?

How?


Solution

  • Funnily, I am just working on this: a Java process running other Java processes. I used the article From Runtime.exec() to ProcessBuilder as a solid base, and When Runtime.exec() won't as a good advice how to gobble the output streams.

    PS.: For those wondering, I had to do that (instead of spawning new threads) because yet another Java process is checking the presence of these processes which are, normally, ran separately with shell commands.