Java, run another application in foreground

前端 未结 4 1419
南笙
南笙 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 20:03

    Consider using commons-exec when dealing with external processes. In my opinion it is much easier to handle than using the Java Runtime class.

    Tutorial : http://commons.apache.org/exec/tutorial.html

提交回复
热议问题