JDK-4295946 : multiple Class-Path entries in jar Manifest not handled properly
  • Type: Bug
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 1.2.0,1.3.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_7,windows_nt
  • CPU: generic,x86
  • Submitted: 1999-12-01
  • Updated: 2006-07-12
  • Resolved: 2006-07-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b91Fixed
Related Reports
Relates :  
Relates :  
Description
The documentation says you can have multiple Class-Path entries in
a Manifest file, e.g.

Class-Path: mail.jar
Class-Path: activation.jar

but this doesn't work.  Only the last Class-Path header seems to be used.
Instead, you have to do this

Class-Path: mail.jar activation.jar

Name: jl125535			Date: 01/18/2002


FULL PRODUCT VERSION :
java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

SunOS carter 5.6 Generic_105181-22
sun4u sparc SUNW,Ultra-80




A DESCRIPTION OF THE PROBLEM :
When I specify 2 jar files in my manifest file as follows:

Class-Path: area.jar<^>
     .
     .
 <many class paths><^>
     .
     .
Class-Path: servlet.jar<^>EOF


Note:<^> means white-space

the manifest.mf in the jar file only contains the last
Class-Path statement.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.create a manifest and include the 2 or more Class-Path
  statements
1.5 back up your manifest file
2. creat a jar include this manifest file in it.
3. open the manifest file in the jar (using WINZIP32.exe,
etc.) and compare to your back-up version.

Note: each jar file name is <= 70 chars

EXPECTED VERSUS ACTUAL BEHAVIOR :

According to:

  
http://java.sun.com/docs/books/tutorial/ext/basics/download.html


" More about the Class-Path Header
If an applet or application uses more than one extension,
you can list multiple URLs in a manifest. For example, the
following is a valid header:
Class-Path: area.jar servlet.jar images/

In the Class-Path header any URLs listed that don't end
with '/' are assumed to be JAR files. URLs ending in '/'
indicate directories. In the preceding example, images/
might be a directory containing resources needed by the
applet or the application.
You can also specify multiple extension URLs by using more
than one Class-Path header in the manifest. For example:

Class-Path: area.jar
Class-Path: servlet.jar

Download extensions can be "daisy chained", meaning that
the manifest of one download extension can have a Class-
Path header that refers to a second extension, which can
refer to a third extension, and so on. "

It should be possible to have multiple Class-Path:
in manifest file.


ERROR MESSAGES/STACK TRACES THAT OCCUR :

No error messages

This bug can be reproduced always.

CUSTOMER WORKAROUND :

Work around is to include ALL jars on one Class-Path:
(Review ID: 138127)
======================================================================

Comments
EVALUATION The fix was to change the text in the tutorial http://java.sun.com/docs/books/tutorial/ext/basics/download.html to correctly reflect that only one Class-Path header is allowed
26-06-2006

SUGGESTED FIX Change the text of http://java.sun.com/docs/books/tutorial/ext/basics/download.html by removing incorrect information stating that more than one Class-Path header is allowed. More than one is NOT allowed, as per Jar spec.
08-05-2006

EVALUATION -- The JAR specification may limit lines to no more than 72 bytes but the specification allows for line continuation. So if there are many relative URLs in the value of the Class-Path attribute then they can be split over extra lines as needed. Using the JAR files from the description we could have this: Class-Path: area.jar servlet.jar In this example 'r' is the last byte on the first line, and ' ' (2 spaces) are the first and second bytes in the second line. The first space is for the line continuation, and the second space is so that the effective attribute value is "area.jar servlet.jar" rather than "area.jarservlet.jar".
06-05-2006

EVALUATION Need to take a look at this in more details. Current version of manifest spec does not allow for duplicate names in the same section. It could be that the Java tutorial is not correct. ###@###.### 2002-05-21
21-05-2002