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

System.setProperty("java.class.path",..)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • generic
    • generic

      Name: eaC66865 Date: 12/10/2002


      It should be noted that attempts to modify the class loader's
      classpath with System.setProperty() is entirely ineffective.

      What, if anything, this call does should be documented.

      Also, pointers to workarounds would be helpful, since anyone
      accessing this API probably wants to add to the classpath
      at runtime.

      This forum message describes a method that is reported to work:
      http://forum.java.sun.com/thread.jsp?forum=32&thread=300557

      It hasn't yet worked for me in 1.4.1, however. I'm not
      sure why. After invoking it, getProperty("java.class.path")
      shows the classpath as unchanged, and I still get class not
      found errors. So either it only worked for 1.2, or I've got
      other problems...

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

      Additional notes:
        * The referenced forum hack does indeed work. However, it is worth
          noting that:
            a) System.getProperty("java.class.path") does not reflect the change
            b) The URL loader class the hack casts the system loader into has
               a getURLs() method that *does* reflect the change.
            c) It appeared not to work because of the issue reported in bug #4791839,
               where System.getProperty("java.home") returns an unexpected value.
      ###@###.### 2002-12-11

            darcy Joe Darcy
            earmstrosunw Eric Armstrong (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: