java - 在运行时进程中执行“启动”
问题描述
我正在尝试通过 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
我不知道如何解决这个问题,所以我只需要帮助。
解决方案
Runtime.getRuntime().exec("cmd.exe /C start steam://rungameid/xxx"");
问题是没有找到如何运行启动。
推荐阅读
- terminal - 无法在 xfce4-terminal 中粘贴文本
- r - 在给定 R 中的向量的情况下创建一个矩阵
- ios - 适用于 Swift 的 Firebase Firestore 似乎没有到达 Google Cloud
- python - Pypy3 pip 安装记录类
- angular - 使用 Angular Schematics 复制文件夹及其内容
- typescript - 类构造函数可选参数
- python - 如何在 Makefile for Windows 中设置环境变量?
- docker - 我无法打开使用 dokku 部署的网站的网址
- unity3d - 带有 Unity 的 Chamilo 不支持 Scorm 1.2
- java - 将 WebClient 请求从微服务发送到另一个微服务时出现错误请求