JDK-6485027 : javac incorrectly handles relative paths in manifest classpath
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0u10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2006-10-23
  • Updated: 2017-05-16
  • Resolved: 2011-03-08
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 7
7 b132Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The first problem is that javac tool running on Windows doesn't understand a relative path within
manifest section, e.g:
  Manifest-Version: 1.0
  Class-Path: ../A.jar

This ends up with such kind of error:
  javac -cp jars/A.jar Main.java
  error: error reading jars\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\
  .\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..
  \.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\..\.\sub\.
  .\.\sub\B.zip; The system cannot find the path specified
  1 error

The second problem is that javac doesn't preserve Class-Path manifest entries for JAR files
in the extensions directories. (the JAR files need to be in different directories to demonstrate
this, because all JAR files in an extensions directory are searched anyway).
This bug could be seen on all platforms.

Error looks like this:

  javac -extdirs jars -cp None Main.java
  Main.java:3: cannot find symbol
  symbol  : variable B
  location: class Main
      public static void main(String []a) { System.exit(A.f() + B.f()); }
                                                              ^
  Main.java:3: operator + cannot be applied to int,B.f
      public static void main(String []a) { System.exit(A.f() + B.f()); }
                                                         ^
  Main.java:3: exit(int) in java.lang.System cannot be applied to (<nulltype>)
      public static void main(String []a) { System.exit(A.f() + B.f()); }
                                                ^
  3 errors

This bugs are illustrated by the attached testcase. Run it by executig:
 $ sh Class-Path2.sh

Comments
EVALUATION The basic bug of handling relative paths in manifest classpaths was fixed in JDK 6. This behavior has now been extended to jar files in extensions directories.
10-02-2011