Windows XP blocks zip files created by my program

I have the following java code to create a zip file. The file works fine on linux, but the core component of Windows XP blocks it. A workaround recommended (go to file properties and unlock) also does not work. I read about similar issues on the Internet and a similar stackoverflow post about this, but none of these solutions work for me. Any ideas on what might cause the problem.

ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ZipOutputStream zipFile = new ZipOutputStream(byteOut);
loop {
    byte [] tempData = "some data".getBytes("UTF-8"); 
    ZipEntry entry = new ZipEntry("blah.txt"); //no path here
    entry.setSize(tempData.length); //read somewhere that this might solve the issue, didn't work
    entry.setTime((new Date()).getTime()); //tried with and without this.. this is probably redundent since putNextEntry sets the time to current too.
    zipFile.putNextEntry(entry);  
    zipFile.write(tempData);
    zipFile.closeEntry();
     }
zipFile.close();         

PS

  • I do not have window protector on my windows machine.
  • I tried to set the record size in zip and still not working.
  • The absolute path is not specified in the zip entry, and there are no slashes in the path.

Thank!

1. , Windows XP . 7zip, , . - , , .

2. Windows, : "Windows , ". , : "Windows , . ". ( → ), .

+3
1

, : , .

ZipEntry entry = ZipEntry ( "blah.txt" ); < - , , , .

0

Source: https://habr.com/ru/post/1776324/


All Articles