commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bugs #6938] SystemClassLoader ignores java.class.path property for clas


From: Archie Cobbs
Subject: [bugs #6938] SystemClassLoader ignores java.class.path property for classfiles
Date: Tue, 02 Dec 2003 18:22:01 -0500
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021106

This mail is an automated notification from the bugs tracker
 of the project: classpath.




/**************************************************************************/
[bugs #6938] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=6938>
Project: classpath
Submitted by: Archie Cobbs
On: Tue 12/02/2003 at 23:22

Severity:  5 - Average
Resolution:  None
Assigned to:  None
Status:  Open
Platform Version:  None


Summary:  SystemClassLoader ignores java.class.path property for classfiles

Original Submission:  It appears that while gnu.java.lang.SystemClassLoader is

written with the intent to use the "java.class.path" system

property as its search path for classfiles, in fact this

doesn't work.



The reason is that the "java.class.path" logic is implemented

via SystemClassLoader.findResource(), but this method is

not invoked by the superclass (java.lang.ClassLoader) when

searching for class files.



Instead, the call trace goes like this:



ClassLoader.loadClass() ->

ClassLoader.findClass() ->

throw new ClassNotFoundException()



Now, this of course only happens when the parent class

loader (in this case the JVM boot loader) is unable to

load the class. But this is a perfectly valid case.



Often times, the "bootstrap" class path (which is

used by the JVM boot loader, but is entirely separate

from the application class path specified by the

"java.class.path" system property) contains the class

file being searched for, which masks this bug, but not

always.



To witness this bug, try setting your boot class path

to NOT contain ".". Then set the "java.class.path"

system property to contain ".". Now try to run a class

from the command line that is in the current working

directory (in some random directory).



This will work with e.g. Sun's JDK but not with a

Classpath based JVM.



The fix is for SystemClassLoader to override the

findClass() method. The Classpath javadoc for

ClassLoader.findClass() gives sample code for

doing so.















For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=6938>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]