sblanton has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I'm having trouble using Archive::Zip to write a file that is then readable by the jar program (Sun JDK 1.5.0_10).
I want to take a JAR created elsewhere and modify a file inside it with perl an write it back out. However, after modification and writing out with Archive::Zip, the jar program gives an error when reading the contents. Here are the stripped down steps:
** This gives no errors or warnings.**use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $az_foo = Archive::Zip->new('foo.jar'); unless ($az_foo->writeToFileNamed('bar.jar') == AZ_OK ) { die 'write error'; } my $az_bar = Archive::Zip->new(); unless ( $az_bar->read('bar.jar') == AZ_OK ) { die 'bad bar bad!' }
java.util.zip.ZipException: only DEFLATED entries can have EXT descrip +tor at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:250) at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:7 +3) at sun.tools.jar.Main.list(Main.java:735) at sun.tools.jar.Main.run(Main.java:191) at sun.tools.jar.Main.main(Main.java:903)
It seems to me the 'META-INF/' directory member is actually expected to be deflated by the jar program - doesn't make sense. I thought I'd ask those wiser than myself before contacting the owner on this one...maybe there is something simple I can do. Cheers and beers.
20070813 Janitored by Corion: Changed PRE tags to P tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Archive::Zip Problem: Zip versus Jar file formats
by Joost (Canon) on Aug 13, 2007 at 18:59 UTC | |
|
Re: Archive::Zip Problem: Zip versus Jar file formats
by jimbojones (Friar) on Aug 15, 2007 at 15:50 UTC | |
by Anonymous Monk on Aug 15, 2007 at 16:06 UTC | |
by sblanton (Sexton) on Aug 22, 2007 at 20:17 UTC | |
by sblanton (Sexton) on Aug 22, 2007 at 20:30 UTC |