Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4433123

javac ignores -classpath option in sameJVM mode

XMLWordPrintable

    • beta
    • generic
    • generic
    • Verified



      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
      $

      ======================================================================

            gafter Neal Gafter (Inactive)
            passunw Pas Pas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: