//windows onlyProcess p = Runtime.getRuntime().exec("cmd.exe /c d:\aa.exe");
p.waitFor();

解决方案 »

  1.   

    //windows only
    Process p = Runtime.getRuntime().exec("cmd.exe /c D:\\aa.exe");
    p.waitFor();
      

  2.   

    import java.io.*;public class ExecFunction() {
        public static void main(String[] arg) {
            Runtime rt = Runtime.getRuntime();
            try {
                String cmd = "C:\\WINNT\\NOTEPAD.EXE";//这里是你的要运行的程序命令
                Process proc = rt.exec(cmd);
                BufferedInputStream errs = new BufferedInputStream(proc.getErrorStream());
                proc.waitFor();
                errs.close();
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    }