# Rubyzip and java.util.zip.ZipFile interoperability issue

**URL:** <https://www.ruby-forum.com/t/rubyzip-and-java-util-zip-zipfile-interoperability-issue/114530>\
**Category:** Rails\
**Created:** [September 14, 2007, 12:37am UTC](https://www.ruby-forum.com/t/rubyzip-and-java-util-zip-zipfile-interoperability-issue/114530 "2007-09-14T00:37:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [September 14, 2007, 12:37am UTC](https://www.ruby-forum.com/t/rubyzip-and-java-util-zip-zipfile-interoperability-issue/114530/1 "2007-09-14T00:37:14Z")

</div>

All,

Going out on a limb here but thought I would ask.

I am generating a ZIP file from a Rails app. with Rubyzip 0.9.1. The  
app. runs on a Mandrake Linux box which writes to a Windows filesystem  
via a Samba mount.

Later, a Java program comes along and uses java.util.zip.ZipFile (JDK  
1.5) to open this ZIP file. Lately I’ve been seeing read exceptions on  
these ZIP files.

Anyone ever seen a case where Java had a problem reading a Ruby  
generated ZIP file before?

Granted I have lots of other moving parts here so…

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/rubyzip-and-java-util-zip-zipfile-interoperability-issue/114530/2 "2007-09-17T13:23:59Z")

</div>

On 14 Sep 2007, at 00:37, Wes G. wrote:

> Anyone ever seen a case where Java had a problem reading a Ruby  
> generated ZIP file before?
> 
> Granted I have lots of other moving parts here so…

IIRC, I had problems with ruby-zip in one of my apps too (i know i  
had to look for other option, but i can’t remember why), I just  
switched over to the shell with the zip and unzip command (just put  
everything in a temp folder, then zip it using the shell). Runs  
smoother and faster than ruby-zip.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [September 17, 2007, 8:05pm UTC](https://www.ruby-forum.com/t/rubyzip-and-java-util-zip-zipfile-interoperability-issue/114530/3 "2007-09-17T20:05:56Z")

</div>

Peter,

I definitely considered that and am glad to hear that it worked.

As it turned out, I was creating and appending to the zip file directly  
on that remote SAMBA mount, so instead what I did was create the ZIP  
file locally, and then copied it to the remote SAMBA mount using  
FileUtils and that seems to work much better.

In fact, I had had the same issue with another part of that same app.,  
and just hadn’t applied the fix across the board.

Thanks for the response.

Wes
