Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用ProcessBuilder修复损坏的zip文件_Java_Zip_Corrupt - Fatal编程技术网

Java 使用ProcessBuilder修复损坏的zip文件

Java 使用ProcessBuilder修复损坏的zip文件,java,zip,corrupt,Java,Zip,Corrupt,当我在Mac终端中执行“zip-FF/Users/myZip.zip?--out Users/myFixed.zip”时,损坏的zip文件被修复。 当我试图修复下面相同的损坏的zip文件时,它会给我以下错误 请分享您的意见以解决此问题 守则: 错误消息: 每个参数都应该是不同的字符串 e、 g 每个参数都应该是不同的字符串 e、 g zip警告:无法打开输入存档:/Users/myZip.zip-我可以想象,无论我将(/Users//或/Users//Desktop/)损坏的文件放在何处,该文

当我在Mac终端中执行“zip-FF/Users/myZip.zip?--out Users/myFixed.zip”时,损坏的zip文件被修复。 当我试图修复下面相同的损坏的zip文件时,它会给我以下错误

请分享您的意见以解决此问题

守则:
错误消息:

每个参数都应该是不同的字符串

e、 g


每个参数都应该是不同的字符串

e、 g


zip警告:无法打开输入存档:/Users/myZip.zip
-我可以想象,无论我将(/Users//或/Users//Desktop/)损坏的文件放在何处,该文件实际上都在
/Users/
下方,我只能通过
zip-FF break.zip--out fixed.zip命令修复mac终端中的损坏文件,但它在我的程序@scarywombat中不起作用。请参见下面的回答
zip警告:无法打开输入存档:/Users/myZip.zip
-我可以想象,无论我把文件放在哪里,文件实际上都在
/Users/
下面(/Users//or/Users//Desktop/)断开的文件,我只能通过
zip-FF break.zip--out fixed.zip
命令在mac终端中修复断开的文件,但它在我的程序@scarywombat中不起作用请参见下面的回答我尝试过,但得到了相同的结果。甚至尝试使用apache commons exec
字符串行=“bash-c zip-FF/Users//myZip.zip--out/Users//myFixed.zip”;CommandLine cmdLine=CommandLine.parse(line);System.out.println(cmdLine.toString());executer executer=new defaultexecuter();executer.execute(cmdLine);executer.setExitValue(1);
但仍然是相同的错误!@ScaryWombatI尝试过,但我得到了相同的结果。甚至尝试使用apache commons exec
String line=“bash-c zip-FF/Users//myZip.zip--out/Users//myFixed.zip”;CommandLine cmdLine=CommandLine.parse(line);System.out.println(cmdLine.toString());Executor executer=new DefaultExecutor();executer.execute(cmdLine);executer.setExitValue(1);
但仍然是相同的错误!@ScaryWombat
ProcessBuilder pb1 = new ProcessBuilder("bash", "-c", "zip -FF/Users/myZip.zip 
   --out /Users/myFixed.zip");
   pb1.redirectErrorStream(true);
   Process p =pb1.start();
1 Fix archive (-FF) - salvage what can
2   zip warning: could not open input archive: /Users/myZip.zip
3 Scanning for entries... 
4  Could not find: /Users/myZip.z01
5
6 
7 Hit c      (change path to where this split file is)
8     s      (skip this split)
9     q      (abort archive - quit)
10    e      (end this archive - no more splits)
11    z      (look for .zip split - the last split)
ProcessBuilder pb1 = new ProcessBuilder("bash", "-c", "zip", "-FF", "/Users/myZip.zip", 
   "--out", "/Users/myFixed.zip");