我试图从我找到此链接的Java程序运行jar文件:here。我使用以下代码:
ProcessBuilder pb = new ProcessBuilder("CEDDextractor_all_img.jar", "-jar", "cedd/");
pb.directory(new File("cedd/"));
Process p = pb.start();
但是我遇到了错误:无法加载图像:无法运行程序“ cedd / CEDDextractor_all_img.jar”(在“ cedd”目录中):CreateProcess error = 193,%1不是有效的Win32应用程序。我对需要指定的路径有些困惑。
批处理命令:
java -jar CEDDextractor_all_img.jar -file "file.jpg"
最佳答案
ProcessBuilder pb = new ProcessBuilder("java", "-jar", "CEDDextractor_all_img.jar", "cedd/");
pb.directory(new File("cedd/"));
Process p = pb.start();
可执行文件是
java
:-)(也可以是javaw
)