JDK-7105520 : Problem while opening 2GB .jar files with java 1.6.0
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 6u26
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2011-10-27
  • Updated: 2012-08-24
  • Resolved: 2012-08-24
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
C:\test_large_jars> java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Client VM (build 20.2-b06, mixed mode, sharing)

The problem reproduced also on version 1.6.0_17, 1.6.0_20 and 1.6.0_24.

ADDITIONAL OS VERSION INFORMATION :
Solaris, Linux, Windows xp... In fact, every OS I've checked so far

A DESCRIPTION OF THE PROBLEM :
I'm working in Amdocs and already contacted your ISV support team regarding this problem (ISV CASE ID - 21846627).
They agreed this issue is a bug and suggested to raise a bug to Oracle support.

The problem is that I get an error message when trying to open a jar file that is bigger than 2GB using the following java command: `java -jar [jarFileName.jar]`.
When running the command `java -jar [jarFileName.jar]` I'm getting the following error:
���Invalid or corrupt jarfile [jarFileName.jar]���

It happens on all OS and machines I've checked so far. I remember specifically WinXP, Linux and Solaris.

I also found a workaround for this problem:
When I use the command `java -cp [jarFileName.jar] [main-class]` the jar file is opened as expected (that's how we know the problem is not with the jar file itself, but with the java command���)
 
The problem occurs also in older versions of java, such as 1.6.0_17. But only from java 1.6.0_20 the workaround (using `java -cp [jarFileName.jar] [main-class]`) actually works.
On java 1.6.0_17 even the workaround fails with ���Exception in thread "main" java.lang.NoClassDefFoundError: [main-class]���


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a valid jar file that its size is greater than 2GB, with a valid main class specified in the manifest.mf file inside.

2. run the following command on any OS, any machine and any java version that is greater that 1.6.0_17:
`java -jar [jarFileName.jar]`

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The Java process starts and the main class start to run.
ACTUAL -
Error message is thrown and the java process stops.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
���Invalid or corrupt jarfile [jarFileName.jar]���

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Run the followig command:
`java -cp [jarFileName.jar] [main-class]`

NOTE: the workaround works only from java 1.6.0_20.
On java 1.6.0_17 and older even the workaround fails with following error message:
���Exception in thread "main" java.lang.NoClassDefFoundError: [main-class]���

Comments
EVALUATION src/share/bin/manifest_info.h/parse_manifest.c have not been updated with those > 2G zipfile bug fixes we have been done mainly in src/share/native/java/util/zip/zip_util.c/h.
09-11-2011

PUBLIC COMMENTS I created 2 GB jar file which includes SwingSet2.jar, it can be reproducible in jdk1.7.0_01 in windowsXPpro. D:\Temp>C:\jdk1.7.0_01\bin\java -jar SwingSet2.jar Error: Invalid or corrupt jarfile SwingSet2.jar
04-11-2011

PUBLIC COMMENTS I tested java -jar SwingSet2.jar it works, but I did not find jar file zise is over 2GB.
01-11-2011