gpt4 book ai didi

java api来运行Windows批处理程序?

转载 作者:行者123 更新时间:2023-12-01 15:05:14 25 4
gpt4 key购买 nike

Possible Duplicate:
How do I run a batch file from my Java Application?

是否有 Java 类来运行 Windows 批处理文件?例如,启动批处理文件并接收批处理运行的结果?

最佳答案

Apache Commons Exec是一个好方法。解决了使用纯 ProcessBuilder 或 Runtime.exec 时遇到的几个问题。

来自项目描述:

Executing external processes from Java is a well-known problem area. It is inheriently platform dependent and requires the developer to know and test for platform specific behaviors, for example using cmd.exe on Windows or limited buffer sizes causing deadlocks. The JRE support for this is very limited, albeit better with the new Java SE 1.5 ProcessBuilder class.

关于java api来运行Windows批处理程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13052393/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com