Notice that the API recommends that, as of version 1.5, the preferred way to create a Process is using ProcessBuilder.start()
.
Another important remark is that the exit value produced by waitFor
is dependent from the program/script being executed. For instance, the exit codes produced by calc.exe are different from notepad.exe.