java - 从java运行vb生成的exe文件并等待执行结束

标签 java

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/

相关文章:

java - Android 请求运行时权限不起作用

java - 封装几个枚举类

java - jersey-media-json-jackson、jersey-json、jersey-media-multipart 之间的区别?

java - JTextField 中的占位符具有正确的方向

java - 如何在 IntelliJ 中使用拖放进行 java swing

java - 无法使用 getResourceAsStream 读取文件

java - 如何从jsp的下拉列表中选择一个选项?

java - 每次迭代后删除二维数组的列和行

Java GUI 设置颜色

java - 如何在JList中只显示文件名?