我正在开发一个Java应用程序来检查源文件中的补丁程序(如果有的话)。检测补丁更改的核心逻辑出现在python脚本中补丁.py']和我的Java应用程序与这个Python补丁脚本通信,以检索操作的退出状态。在
python脚本可以从here获得
在windows中,它运行得很好,但是在Linux环境下。脚本本身不会从Java应用程序调用。我不知道我哪里出错了。在
我使用'ProcessBuilder'调用python脚本,源代码如下:if (System.getProperty("os.name").indexOf("Windows") != -1) {
ArrayList command = new ArrayList();
//Cmd prompt will be launched, if platform is Windows.
command.add("cmd");
command.add("/c");
command.add("python");
command.add("lib/patch.py");
command.add("-d");
command.add(auxSrcFile);
command.add(diffFileLoc);
command.add("--revert"); // switch to revert the patch
pb = new ProcessBuilder(command);
} else {
ArrayList command = new ArrayList();