JDK-4274235 : Class-Path attribute of manifest file needs new line character at end of line
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 1.2.2,1.3.0,1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt,windows_2000
  • CPU: x86
  • Submitted: 1999-09-21
  • Updated: 2007-02-05
  • Resolved: 2007-02-05
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
Name: skT88420			Date: 09/21/99


In manifest file, if you don't press enter key(in another word, new line character) at end of Class-Path line, java will not load any jar file on Class-Path line.
How come they don't check EOF?

I had something like following with out new line at end and I could not load image. However after i put new line character at end of class path line, it worked fine.

Main-Class: Server
Class-Path: image.jar
(Review ID: 95553) 
======================================================================

Name: skT45625			Date: 11/06/2000


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

The final line of a manifest line is ignored by jar if the line is not
terminated with a newline.  This bug can be demonstrated by creating a manifest
file and not newline terminating the final line (notepad can do this on NT).
This causes a variety of severe problems like the main class of a would-be
executable jarfile not being known or the classpath not being set.  This is
similar to bug report 4274235 except that it is still present in 1.3.0 and it
doesn't really seem to be just an enhancement request anymore.  The 1.3 jar
documentation specifically mentions the case of files whose last line ends in an
EOF instead of a newline and claims that this case is being handled:

---------------------

from http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR Manifest

Before parsing:
     If the last character of the file is an EOF character (code 26), the EOF is
treated as whitespace. Two newlines are appended (one for editors that don't put
a newline at the end of the last line, and one so that the grammar doesn't have
to special-case the last entry, which may not have a blank line after it).

---------------------

I would therefore suggest that this is not an enhancement waiting to happen but
an actual bug.  This bug causes quite a few problems for beginning manifest
authors, and I can't imagine it would be that difficult to fix.
(Review ID: 111861)
======================================================================

Comments
EVALUATION Closing this very old bug due to reasons given in prior evaluation, and because existing duplicate 4333854 has been closed as "not a defect" since 2002.
05-02-2007

PUBLIC COMMENTS All lines in Manifest should end with a new line. This is a part of Manifest spec. It may be unfortunate, but it is a part of Manifest spec now and can not be changed because of compatibility reasons - there are some parsers which expect this new line.
10-06-2004

EVALUATION All lines in Manifest should end with a new line. This is a part of Manifest spec. It may be unfortunate, but it is a part of Manifest spec now and can not be changed because of compatibility reasons - there are some parsers which expect this new line. ###@###.### 2002-03-14
14-03-2002