首页 > 解决方案 > 在运行时进程中执行“启动”

问题描述

我正在尝试通过 java 代码启动一个蒸汽应用程序。

首先,我必须想办法用 cmd 打开它,这很简单,我只需要输入start steam://rungameid/xxx

现在,我需要我的 java 程序来打开应用程序

这是我到目前为止所尝试的。

Runtime.getRuntime().exec("start steam://rungameid/xxx");

new ProcessBuilder("start", "steam://rungameid/xxx").start()

他们都导致了 IOException

Exception in thread "main" java.io.IOException: Cannot run program "start": CreateProcess error=2, The system cannot find the file specified

我不知道如何解决这个问题,所以我只需要帮助。

标签: javaruntimeruntime.exec

解决方案


Runtime.getRuntime().exec("cmd.exe /C start steam://rungameid/xxx"");      

问题是没有找到如何运行启动。


推荐阅读