javaを使用してファイルを解凍しようとしていますが、 'ze'がnullのためwhileループに入りません。しかし、私は7zipアプリケーションを使用して解凍することができます同じファイル。誰かが私になぜこれが幸せであるかを教えてもらえますか?Javaを使用してファイルを解凍することはできませんが、7zipを使用してファイルを解凍することはできません。
試し{ここ
//get the zip file content
ZipInputStream zis =
new ZipInputStream(new FileInputStream(zipFile));
//get the zipped file list entry
ZipEntry ze = zis.getNextEntry();
while(ze!=null){
String fileName = ze.getName();
File newFile = new File(outputFolder + File.separator + fileName);
System.out.println("file unzip : "+ newFile.getAbsoluteFile());
//create all non exists folders
//else you will hit FileNotFoundException for compressed folder
new File(newFile.getParent()).mkdirs();
FileOutputStream fos = new FileOutputStream(newFile);
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close();
ze = zis.getNextEntry();
}
zis.closeEntry();
zis.close();
System.out.println("Done");
}catch(IOException ex){
ex.printStackTrace();
}
.7zファイル、または.zipファイルですか? – AJNeufeld