FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
With one jar file in the current directory, the classpath is allowed to set to *.jar without causing compilation error. And this jar file contains class(es) on which Test.java depends.
"javac -classpath *.jar Test.java"
However, if there are more than one jar file in the directory, compilation fails.
This seems like a bug because according to Sun doc on classpath http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html, the value of classpath should end with the name of a *.zip or *.jar for jar files. Furthermore, it doesn't make any sense to use wildcard, i.e. *.jar, when only one jar is allowed in the directory.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
---Test.java in workarea directory---
import com.Print;
public class Test {
public static void main(String[] args) {
Print p = new Print();
}
}
---Print.java in com directory---
package com;
public class Print { }
Compile this file and then create a jar file:
c:workarea\other\com>javac Print.java
c:workarea\other\com>cd ..
c:workarea\other>jar cvf pkg.jar com
---------------
Place the pkg.jar into the workarea directory and compile Test.java.
c:\workarea>copy .\other\pkg.jar .
c:\workarea>javac -classpath *.jar Test.java
No compilation error reported.
--------------
Put some jar files in the workarea directory and run the previous command again:
c:\workarea>copy c:\jdk\jre\lib\deploy.jar .
c:\workarea>javac -classpath *.jar Test.java
Compilation fails.
javac: invalid flag: pkg.jar
Usage: javac <options> <source files>
REPRODUCIBILITY :
This bug can be reproduced always.
###@###.### 2005-06-02 06:56:47 GMT