为什么这个程序不能打开计算器
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 ");
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");
试试。