Re: behaviour of getResource()
hiwa wrote:
Andrew Thompson wrote:
a) Why?
b) Where is it documented?
API documentation of Class.getResource() method.
Ohhh.. you mean the bit that says..
"This method delegates to this object's class loader.
If this object was loaded by the bootstrap class
loader, the method delegates to
<link>ClassLoader.getSystemResource(java.lang.String)</link>. "?
...which goes on to say..
"Find a resource of the specified name from the
search path used to load classes. "
Consider me slapped (slightly).
But.. why is "WhereAmI.java" (or the "WhereAmI.class",
for that matter) *not* on the 'search path used to load
classes'? That would be 'the classpath', right?
The classpath (as I understand that statement to mean)
includes 'the current directory' of the "WhereAmI.java"
source as well as the default package "WhereAmI.class".
I just do not get what part is telling me why the bootstrap*
(or any other) classloader will not find these resources that
(as far as I understand) are on the classpath.
* Is there something (else) I missed about the 'bootstrap'**
classloader that says it is for 'core API' classes/resources
only?
** <http://www.google.com.au/search?q=definition+bootstrap>
...oh - those first few definitions are very much more
focused on the *initial* binaries needed to start the
thing being discussed (usually OS's) than I had
taken 'bootstrap' to mean ..
My definition of 'bootstrap' when applied to an OS is
that it might include the stuff in the 'Start-Menu'
(speaking Windows'ese), whereas those definitions
of 'bootstrap' would seem to exclude such extra cruft.
In that sense, it could be implied that the use of the word
'bootstrap' in itself, implies only J2SE core classes?
My confusion was compounded by misunderstanding
the meaning of 'bootstrap'.
Consider me /thoroughly/ slapped.. ;-)
Andrew T.