Name: poR10007 Date: 04/03/2001
Javac since jdk1.4.0beta-b55 ignores -classpath option when
is run by VM for which in turn its own -classpath option is set.
It uses system classpath instead of using classpath specified
by the option.
That contradicts to conceptions described in "Setting the class path"
section of, for example, SDK 1.3 documentaion
(http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/classpath.html):
"The class path can be set using either the -classpath option when calling
an SDK tool (the preferred method) or by setting the CLASSPATH environment
variable. The -classpath option is preferred because you can set it
individually for each application without affecting other applications
and without other applications modifying its value."
Javac from jdk1.4.0beta-b54 uses -classpath option correctly.
The following test demonstrates the behavior:
--a/A.java---------------------------------------------------
public class A {
}
--------------------------------------------------------------
--Test.java------------------------------------------------
public class Test extends A {
}
--------------------------------------------------------------
The execution log is following:
$ jdk1.4.0beta-b55/solsparc/bin/java -classpath jdk1.4.0beta-b55/solsparc/lib/tools.jar com.sun.tools.javac.Main -d a a/A.java
$ jdk1.4.0beta-b55/solsparc/bin/java -classpath jdk1.4.0beta-b55/solsparc/lib/tools.jar com.sun.tools.javac.Main -d . -classpath a Test.java
Test.java:1: cannot resolve symbol
symbol : class A
location: class Test
public class Test extends A {
^
1 error
$ jdk1.4.0beta-b55/solsparc/bin/java -classpath jdk1.4.0beta-b54/solsparc/lib/tools.jar com.sun.tools.javac.Main -d . -classpath a Test.java
$ echo $?
0
$
======================================================================