public class unrarutil {
/**
* 采用命令行方式解压文件
* @param zipFile 压缩文件
* @param destDir 解压结果路径
* @param cmdPath WinRAR.exe的路径,也可以在代码中写死
* @return
*/
public static boolean realExtract(File zipFile, String destDir, String cmdPath) {
// 解决路径中存在/..格式的路径问题
destDir = new File(destDir).getAbsoluteFile().getAbsolutePath();
while(destDir.contains("..")) {
String[] sepList = destDir.split("\\\\");
destDir = "";
for (int i = 0; i < sepList.length; i++) {
if(!"..".equals(sepList[i]) && i < sepList.length -1 && "..".equals(sepList[i+1])) {
i++;
} else {
destDir += sepList[i] + File.separator;
}
}
}
boolean bool = false