编辑:-我需要批次处理来自我的JavaFX应用程序的许多处理草图文件。下面的代码适用于Windows。我想让它在Mac上运行,但不确定如何运行。
我的工作流程如下:
//as the user for the processing-java.exe file
processingJavaProrgramFile = fileChooser.showOpenDialog(stage);
if (processingJavaProrgramFile != null) {
processingJavaProrgramPath = processingJavaProrgramFile.getPath();
}
//ask the user for the processing sketch folder
processingSketchDir = directoryChooser.showDialog(stage);
if (processingSketchDir != null) {
sketchPath = processingSketchDir.getPath();
}
//java run time exec method to compile sketch in user folder using through processing-java.exe
Runtime.getRuntime().exec(
processingJavaProrgramPath +
" --force --run --sketch=" +
sketchPath + " --output=" +
sketchPath+File.separator +
"temp"
);怎么才能让它在Mac上运行呢?首先,Mac版本没有一个处理-java.exe。它应该是一个不同的工作流吗?如果是这样的话,我如何让应用程序知道它是在Windows还是Mac上运行,以便运行适当的方法?
发布于 2014-07-23 22:22:55
好的找到了我两个问题的解决方案。
为了获得OS类型,我使用了方法here
要在mac上使用相同的代码运行处理,我需要:
从处理中,转到tools菜单并安装“processing”。以某种方式将其安装到系统中。因此,在Mac情况下,用户不需要选择处理-java类似于Windows的路径(选择process-java.exe)。在mac上,用户只需选择输出文件夹。
https://stackoverflow.com/questions/24897822
复制相似问题