Error opening zip file created using java

Anoop picture Anoop · Nov 1, 2010 · Viewed 15.1k times · Source

I created a small application to read some files from the disk and zip it using java.util.zip.ZipOutputStream. It is successfully creating the zip file. But in windows when i try to open it / extract it am getting the error message like "Windows has blocked access to these files to help protect your computer". I am zipping only csv files. But if i try to unzip using the zipinputstream class from java itself, its unzipping it correctly. Can anyone throw some light on it.

regards, Anoop

Answer

Anoop picture Anoop · Nov 1, 2010

Finally I found out the problem. It was related to the path. its really funny, but if u give the absoute path of the files to be zipped to zipoutputstream, this error happens. i tried with relative paths and BINGO!!! it worked. Hence i did some work around before zipping and pointed the parent of the files to the current working directory and then zipped. Thanks all for the responses.