Archive::Zip corrupts JAR's??

R

rog

Hi, I am having problems with adding new files (via winzip/winwar etc)
to JAR files that have been opened and saved using Archive::Zip - EG:

use strict;
use Archive::Zip;
my $testfile = 'ZipTest';
open (FH,">$testfile.java") || die "Error: $!\n";
print FH <<EOF;
public class ZipTest {
public static void main (String [] args) {
System.out.println("This is a test");
}
}
EOF
close FH;
unlink "$testfile.jar";
print `javac $testfile.java`;
print `jar cf ZipTest.jar $testfile.class`;
my $zip = Archive::Zip->new("$testfile.jar");
$zip->overwrite(); # this corrupts jar file somehow as Windows
# Zip tools can read the archive but cant add files to it

Any ideas would be appreciated. I'm using ActivePerl v5.8.3 with
Archive::Zip v1.82 and Java v1.4.2

Many thanks
Roger
 
G

Gregory Toomey

rog said:
Hi, I am having problems with adding new files (via winzip/winwar etc)
to JAR files that have been opened and saved using Archive::Zip - EG:

use strict;
use Archive::Zip;
my $testfile = 'ZipTest';
open (FH,">$testfile.java") || die "Error: $!\n";
print FH <<EOF;
public class ZipTest {
public static void main (String [] args) {
System.out.println("This is a test");
}
}
EOF
close FH;
unlink "$testfile.jar";
print `javac $testfile.java`;
print `jar cf ZipTest.jar $testfile.class`;
my $zip = Archive::Zip->nehttp://linuxshop.ru/linuxbegin/win-lin-soft-en table.shtmlw("$testfile.jar");
$zip->overwrite(); # this corrupts jar file somehow as Windows
# Zip tools can read the archive but cant add files to it

Any ideas would be appreciated. I'm using ActivePerl v5.8.3 with
Archive::Zip v1.82 and Java v1.4.2

Many thanks
Roger

I think you have to simplify your example.

When I started using Archive::Zip, I did manage to write "zip" files that
could not be read in some circumstances. It turned out to be a bug on my
part. Now I use Archive::Zip thousnands of times per day & works fine. I've
never used the overwrite method.

gtoomey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,134
Latest member
Lou6777736
Top