Ease of use is the only real difference between those two.
Note that ease of use can lead to security by helping to avoid mis-use.
At least on OpenJDK 6 Runtime.exec()
is implemented using ProcessBuilder
:
public Process exec(String[] cmdarray, String[] envp, File dir)
throws IOException {
return new ProcessBuilder(cmdarray)
.environment(envp)
.directory(dir)
.start();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…