Possible Duplicate:
running an Executable file and then waiting for that particular exe file to no longer be running
我想从java运行一个vb生成的exe文件并等待该文件完成执行。
我尝试使用p.waitFor()
但没有成功。
还有其他选择吗?
最佳答案
这实际上应该有效:
Runtime.getRuntime().exec(<file.exe>).waitfor();
除非涉及子进程的标准输入/标准输出,否则可能会陷入死锁:
JDK 的 Javadoc 文档提供以下信息:
some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.
这很好解释here
关于java - 从java运行vb生成的exe文件并等待执行结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12171925/