dcsimg

What's the difference between Runtime.exec() and ProcessBuilder?

John Zukowski

JDK 5.0 added a new class, ProcessBuilder to do the equivalent of the exec() method of Runtime. In addition to running commands in forked off subprocesses, you can adjust environment variables and change the starting working directory with ProcessBuilder.