使用java 方法调用linux命令 bcompare -silennt .... 执行后的返回结果为1 不知道是什么原因。
java 方法:
//
public static int callShell(String[] shellString) {
try {
Process process = Runtime.getRuntime().exec(shellString);
int exitValue = process.waitFor();
System.out.println("exitValue"+exitValue);
if (0 != exitValue) {
throw new Exception("call shell failed. error code is :"
+ exitValue);
} else {
return 0;
}
} catch (Throwable e) {
System.out.println("call shell failed. " + e);
}
return 0;
}
String[] shellString = new String[] {
"/bin/sh"
,"bcompare"
,"-silent"
,"@" + execJSPath
,oldfilefullpath
,newfilefullpath
,newfileName };
int re = callShell(shellString);
程序执行后 exitValue 打印的值一直为1 不知问题出在哪里。
compare 的帮助文档给出的说明是
Return codes
Code Meaning
0 Success
1 Binary same
2 Rules-based same
11 Binary differences
12 Similar
13 Rules-based differences
14 Conflicts detected
100 Unknown error
101 Conflicts detected, merge output not written
102 BComp.exe unable to wait until BCompare.exe finishes
103 BComp.exe cannot find BCompare.exe
104 Trial period expired
105 Error loading script file
106 Script syntax error
107 Script failed to load folders or files
compare4在线的帮助文档 使用搜索功能 搜索【Command Line Reference】
http://www.scootersoftware.com/v4help/
1 Binary same 有了这个说明 可还是不知道怎么解决 请大神们有经验的指点一下!!!