JDK-4791758 : System.setProperty("java.class.path",..)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2002-12-11
  • Updated: 2006-08-25
  • Resolved: 2006-08-25
Related Reports
Duplicate :  
Description
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

Comments
EVALUATION Special case of general problem discussed in 4165411.
25-08-2006

WORK AROUND Name: eaC66865 Date: 12/10/2002 ======================================================================
11-06-2004