我正在尝试通过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
我不知道如何解决此问题,所以我只需要伸出援手。
Runtime.getRuntime().exec("cmd.exe /C start steam://rungameid/xxx"");
问题没有找到开始的方式。