Duplicate :
|
FULL PRODUCT VERSION : java version "1.5.0_07" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03) Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode) ADDITIONAL OS VERSION INFORMATION : Solaris 10, or Linux, or Windows A DESCRIPTION OF THE PROBLEM : When using javac with a classpath for a jar file that contains a Class-Path entry in its manifest that uses a relative path, javac can end up in an infinite loop creating Strings until it runs out of memory. The problem appears to be with the way that javac decides whether it has previously encountered a jar file. It doesn't consider relative paths as being the same: for example ../Foo/Foo.jar is the same jar file as ../Foo/../Foo/Foo.jar but javac treats them as different. This can cause all sorts of errors including OutOfMemory (which we've seen with real code) and a zip error in the example given below. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Create a directory e.g $HOME/Foo 2. Create a file MyManifest.txt that contains just this text : Class-Path: ../Foo/Foo.jar 3. Create an empty jar file : jar cvf Foo.jar . 4. Add the manifest : jar cfm Foo.jar MyManifest.txt 5. Put a trivial java source file into the directory and compile it as javac -classpath Foo.jar Test.java Note the error message. REPRODUCIBILITY : This bug can be reproduced always.