在运行时过程中执行'开始'

问题描述 投票:0回答:1

我正在尝试通过Java代码启动Steam应用程序。

首先,我不得不想出一种使用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

我不知道如何解决此问题,所以我只需要伸出援手。

java runtime runtime.exec
1个回答
0
投票
Runtime.getRuntime().exec("cmd.exe /C start steam://rungameid/xxx"");
问题没有找到开始的方式。
© www.soinside.com 2019 - 2024. All rights reserved.