API中的Runtime类其中有个方法:
Process exec(String[] cmdarray, String[] envp, File dir)
在指定环境和工作目录的独立进程中执行指定的命令和变量。 这几个参数cmdarray,envp和dir是怎么取值的,我不是很懂,谁能给我举个例子啊
Process exec(String[] cmdarray, String[] envp, File dir)
在指定环境和工作目录的独立进程中执行指定的命令和变量。 这几个参数cmdarray,envp和dir是怎么取值的,我不是很懂,谁能给我举个例子啊
Process Exec
package com.ack.j2se.lang;import java.io.IOException;public class ProcessExec {
public static void main( String[] argv ) {
String command = "c:\\winnt\\explorer.exe"; try {
Process process = Runtime.getRuntime().exec( command );
}
catch( IOException ioex ) {
ioex.printStackTrace();
}
}
}
public static void main(String [] args){
try{
Process process=Runtime.getRuntime().exec("p.exe");
process.waitFor();
System.out.println("DOS Sucess");
}catch(Exception e){
e.printStackTrace();
}
}}
还是要谢谢各位的帮助