Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在eclipse中运行这段代码:
Process process = Runtime.getRuntime().exec("cmd /c emulator -avd OrangeAutoTest");
我的应用程序将挂起,我无法关闭 cmd 窗口
我找到了解决方案: 我应该先这样运行:
Runtime.getRuntime().exec("cmd /c start cmd.exe /K emulator -avd OrangeAutoTest");
应用程序不会挂断
我很确定它是这样工作的。
.exec("program args");
因此不应该是:
Process process = Runtime.getRuntime().exec("cmd.exe /c emulator -avd OrangeAutoTest");