package org.tgl;
public class RuntimeDemo {
public static void main(String[] args) {
Runtime run = Runtime.getRuntime();
try{
run.exec("caculator.exe");
}
catch (Exception e){
e.printStackTrace();
}
}
}
------解决方案--------------------
runtime.exec("cmd /c start calc.exe ");
- Java code
package org.tgl;public class RuntimeDemo {public static void main(String[] args) {Runtime run = Runtime.getRuntime();try{run.exec("cmd /c start calc.exe "); }catch (Exception e){e.printStackTrace();}}}
------解决方案--------------------
run.exec("calc.exe");
试试。