Java,在前台运行另一个应用程序 [英] Java, run another application in foreground

查看:183
本文介绍了Java,在前台运行另一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从java代码运行另一个应用程序。

I want run another application from java code.

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

流程已启动,但在后台运行。如何使它在前台运行?

Process is launched, but in background. How to make it run in foreground?

推荐答案

您应该告诉cmd.exe您希望它在新窗口中打开:

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

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

这篇关于Java,在前台运行另一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆