Problem definition:
My java program tries to unzip a zip file using java.util.zip classes. It fails right in the first line given below:
Exception thrown:
The following exception is thrown with the above line.
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:105)
at java.util.zip.ZipFile.<init>(ZipFile.java:70)
Important note:
1) The file name is properly defined and it is a valid zip file. Any suspicion like a wrong file path or improper access privilege can be ruled out.
2) The zip file was not generated using java.util.zip. It was generated by a third party tool. However, the zip file would open without any problem with unzip utility in Sun solaris or with a winzip program in Windows 2000. But, my java program using java.util.zip API is not able to unzip it.
My Questions:
What is so different about the zip file that Java implementation refuse s to unzip it?
Is there a standard protocol( on top of normal zipping mechanism) that the zipping program should have followed so that my java program would unzip it correctly?
Or, is there any other way to unzip files correctly in Java?
I have tried several things, haven't had any luck so far. Any pointer will be greatly appreciated.
Thanks in advance,
Ganesh
My java program tries to unzip a zip file using java.util.zip classes. It fails right in the first line given below:
Code:
ZipFile oZip = new ZipFile(strFileName);
Exception thrown:
The following exception is thrown with the above line.
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:105)
at java.util.zip.ZipFile.<init>(ZipFile.java:70)
Important note:
1) The file name is properly defined and it is a valid zip file. Any suspicion like a wrong file path or improper access privilege can be ruled out.
2) The zip file was not generated using java.util.zip. It was generated by a third party tool. However, the zip file would open without any problem with unzip utility in Sun solaris or with a winzip program in Windows 2000. But, my java program using java.util.zip API is not able to unzip it.
My Questions:
What is so different about the zip file that Java implementation refuse s to unzip it?
Is there a standard protocol( on top of normal zipping mechanism) that the zipping program should have followed so that my java program would unzip it correctly?
Or, is there any other way to unzip files correctly in Java?
I have tried several things, haven't had any luck so far. Any pointer will be greatly appreciated.
Thanks in advance,
Ganesh