-
Bug
-
Resolution: Duplicate
-
P3
-
7
-
generic
-
generic
Peter Ahe wrote: (edited:jjg)
> Hi Jon!
>
> We have discovered a bug in javac's zip file optimization. I looks like
> an issue with jar files with more than 64k entries. The workaround we
> found was to add "-J-DuseJavaUtilZip=false" to the list of options.
>
> Cheers,
> Peter
>
> $ javac MakeJar.java && java MakeJar foo.jar
> $ cd foo
> $ javac -J-showversion -J-DuseJavaUtilZip=false -cp ../foo.jar Foo.java
> java version "1.7.0-ea"
> Java(TM) SE Runtime Environment (build 1.7.0-ea-b57)
> Java HotSpot(TM) Client VM (build 16.0-b02, mixed mode, sharing)
>
> $ javac -J-showversion -cp ../foo.jar Foo.java
> java version "1.7.0-ea"
> Java(TM) SE Runtime Environment (build 1.7.0-ea-b57)
> Java HotSpot(TM) Client VM (build 16.0-b02, mixed mode, sharing)
>
> Foo.java:1: cannot find symbol
> public class Foo extends MakeJar {}
> ^
> symbol: class MakeJar
> 1 error
>
> $ head -10000 ../MakeJar.java Foo.java
> ==> ../MakeJar.java <==
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.InputStream;
> import java.util.jar.JarOutputStream;
> import java.util.zip.ZipEntry;
>
> public class MakeJar {
> public static void main(String... args) throws Exception {
> JarOutputStream s = new JarOutputStream(new FileOutputStream(new
> File(args[0])));
> for (int i = 0; i < 100000; i++) {
> s.putNextEntry(new ZipEntry("" + i + ".txt"));
> }
> String classFileName = MakeJar.class.getSimpleName() + ".class";
> s.putNextEntry(new ZipEntry(classFileName));
> InputStream i = MakeJar.class.getResourceAsStream(classFileName);
> byte[] bytes = new byte[i.available()];
> i.read(bytes);
> s.write(bytes);
> s.close();
> }
> }
>
> ==> Foo.java <==
> public class Foo extends MakeJar {}
> Hi Jon!
>
> We have discovered a bug in javac's zip file optimization. I looks like
> an issue with jar files with more than 64k entries. The workaround we
> found was to add "-J-DuseJavaUtilZip=false" to the list of options.
>
> Cheers,
> Peter
>
> $ javac MakeJar.java && java MakeJar foo.jar
> $ cd foo
> $ javac -J-showversion -J-DuseJavaUtilZip=false -cp ../foo.jar Foo.java
> java version "1.7.0-ea"
> Java(TM) SE Runtime Environment (build 1.7.0-ea-b57)
> Java HotSpot(TM) Client VM (build 16.0-b02, mixed mode, sharing)
>
> $ javac -J-showversion -cp ../foo.jar Foo.java
> java version "1.7.0-ea"
> Java(TM) SE Runtime Environment (build 1.7.0-ea-b57)
> Java HotSpot(TM) Client VM (build 16.0-b02, mixed mode, sharing)
>
> Foo.java:1: cannot find symbol
> public class Foo extends MakeJar {}
> ^
> symbol: class MakeJar
> 1 error
>
> $ head -10000 ../MakeJar.java Foo.java
> ==> ../MakeJar.java <==
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.InputStream;
> import java.util.jar.JarOutputStream;
> import java.util.zip.ZipEntry;
>
> public class MakeJar {
> public static void main(String... args) throws Exception {
> JarOutputStream s = new JarOutputStream(new FileOutputStream(new
> File(args[0])));
> for (int i = 0; i < 100000; i++) {
> s.putNextEntry(new ZipEntry("" + i + ".txt"));
> }
> String classFileName = MakeJar.class.getSimpleName() + ".class";
> s.putNextEntry(new ZipEntry(classFileName));
> InputStream i = MakeJar.class.getResourceAsStream(classFileName);
> byte[] bytes = new byte[i.available()];
> i.read(bytes);
> s.write(bytes);
> s.close();
> }
> }
>
> ==> Foo.java <==
> public class Foo extends MakeJar {}
- duplicates
-
JDK-7018859 javac turn off the Zip optimization by default
- Closed
- relates to
-
JDK-7021927 javac: regression in performance
- Closed