Name: ouC59006 Date: 06/18/98
When the compiler is called from some java program, it can't find some classes
which are actually on the CLASSPATH variable. My understanding is that the compiler
now (starting from JDK-1.2beta4-H) is being loaded by the same class loader as the
user aplication. Then, it should find all the classes which are on the user
CLASSPATH.
Example a.java below exhibits the problem. Note that if one sets that same
class path into -Xsysclasspath java option, it runs the program successfully.
For the first time this behaviour appeared in JDK-1.2beta4-H.
--> echo $JAVA_HOME
/export/ld14/java/dest/jdk1.2b4J/solaris
--> java -fullversion
java full version "JDK-1.2beta4-J"
--> setenv CLASSPATH ${JAVA_HOME}/lib/tools.jar:.
--> javac a.java
--> java a
[parsed a.java in 833 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/Object.class) in 54 ms]
[checking class a]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/String.class) in 59 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/io/Serializable.class) in 2 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/Comparable.class) in 2 ms]
a.java:3: Class sun.tools.javac.Main not found.
new sun.tools.javac.Main(System.out, "javac").compile(new String[] { "-verbose", "-d", ".", "a.java" });
^
1 error
[done in 1866 ms]
-->
-->
--> java -sysclasspath:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/tools.jar:. a
[parsed a.java in 571 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/Object.class) in 72 ms]
[checking class a]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/String.class) in 58 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/io/Serializable.class) in 3 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/Comparable.class) in 2 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/lib/tools.jar(sun/tools/javac/Main.class) in 80 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/lib/tools.jar(sun/tools/java/Constants.class) in 142 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/lib/tools.jar(sun/tools/java/RuntimeConstants.class) in 205 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/System.class) in 37 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/io/PrintStream.class) in 22 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/io/FilterOutputStream.class) in 6 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/io/OutputStream.class) in 5 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/io/IOException.class) in 3 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/Exception.class) in 3 ms]
[loaded /export/ld14/java/dest/jdk1.2b4J/solaris/jre/lib/rt.jar(java/lang/Throwable.class) in 12 ms]
[wrote ./a.class]
[done in 2524 ms]
-->
--------------------a.java----------------------
public class a {
public static void main(String[] argv) {
new sun.tools.javac.Main(System.out, "javac").compile(new String[] { "-verbose", "-d", ".", "a.java" });
}
}
======================================================================