United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6485027 javac incorrectly handles relative paths in manifest classpath
JDK-6485027 : javac incorrectly handles relative paths in manifest classpath

Details
Type:
Bug
Submit Date:
2006-10-23
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
tools
OS:
windows_2000
Sub-Component:
javac
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0u10
Fixed Versions:

Related Reports
Backport:
Relates:
Relates:
Relates:

Sub Tasks

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.
                                     
2011-02-10



Hardware and Software, Engineered to Work Together