public Process exec(String command) throws IOException
和
public Process exec(String cmdarray[]) throws IOException
其实是等价的,最终都会调用
public Process exec(String[] cmdarray, String[] envp, File dir) throws IOException
因为如下代码:
public Process exec(String command, String[] envp, File dir)
throws IOException {
if (command.length() == 0)
throw new IllegalArgumentException("Empty command");
StringTokenizer st = new StringTokenizer(command);
String[] cmdarray = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++)
cmdarray[i] = st.nextToken();
return exec(cmdarray, envp, dir);
}
这里最终是:
return exec(cmdarray, envp, dir);