gpt4 book ai didi

Java Process Builder IO 异常 - 不会运行程序

转载 作者:行者123 更新时间:2023-11-29 05:53:17 25 4
gpt4 key购买 nike

这是我的代码,我不确定为什么会出现以下错误:

 Opening firefox at Sun Oct 28 21:45:27 EDT 2012
java.io.IOException: Cannot run program "firefox.exe": CreateProcess error=2, The system cannot find the file specified

public static void open(String app) {
try {
Calendar calendar = Calendar.getInstance();
Date now = calendar.getTime();
System.out.println("Opening " + app + " at " + now);
ProcessBuilder builder = new ProcessBuilder(app+".exe");
builder.start();
}
catch (IOException e) {
System.out.println(e);
}
}

有什么建议吗?

最佳答案

您必须指定 Firefox 可执行文件的完整路径。

关于Java Process Builder IO 异常 - 不会运行程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13114991/

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