Java, run another application in foreground

前端 未结 4 1344
南笙
南笙 2021-01-12 19:39

I want run another application from java code.

Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(\"cmd.exe\");

Process is launched, b

4条回答
  •  太阳男子
    2021-01-12 19:54

    You should tell cmd.exe that you want it to open in new window:

    Process pr = rt.exec("cmd.exe /c start");
    

提交回复
热议问题