I've recently decided to write a launcher for my project. It simply downloads updated files from my server, unpacks them, merges some of the files (because their content varies on settings of the launcher) and packs them into one .zip file.

I'm sure the downloading and merging processes work perfectly, but the last one - zipping - doesn't.

The .zip file is created correctly, but when I put it into the game dir, the game won't start (says it's corrupted). But if I open it with WinRar (yes, it opens without errors - the "Test" function shows no errors, too) and just add one, random file inside, the game STARTS!

Seems like WinRar re-creates the zip file in a correct way, but I can't make my launcher to do so.

("wypakowane" is the directory that contains all the files I want to put into ZIP file.)
I just compared both archives - the one created by my java app and the one created by WinRar by adding random file. They are identical, have the same CRCs, same attributes and unpack correctly. But the game crashes with the first one, and runs smoothly with the second one. I'm running out of ideas. Any help?
Edited by: 949768 on 2012-07-30 05:28

Just a wild guess. Your comments in your code show non-ASCII characters. Do you have non-ASCII characters in your file or directory names? If yes, see the discussion here:
https://blogs.oracle.com/xuemingshen/entry/non_utf_8_encoding_in

No, file and directory names are all in English. The launcher GUI is in Polish, because it downloads Polish localization for a game. The files are just modifications of original ones from English game package.

I made some listing with WinRar. The "java" file is a listing of the one generated by my app:
http://www.sendspace.com/file/w9u670

The ZIP format contains several compression methods. Java uses the deflate method that is implemented in zlib library. WinRAR supports several compression methods. Check what your default compression method has been set to. Seems like your game is only supporting a specific method which happens to be what your WinRAR is configured to use by default. Try generating your zip without compression (ie stored method). Maybe your game will like that more.