ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <JFernan...@viquity.com>
Subject RE: ClassLoader ?
Date Thu, 10 Aug 2000 00:04:38 GMT
In general this problem is solved by using a hierarchy of ClassLoaders as of
the 1.2 spec. However, we do not have that luxury in 1.1. With the hierarchy
we can stack the classloaders and guarantee that we return consistent
classes.

The only problem with this mechanism is that classes loaded by parent
loaders cannot load classes comming from sibling classloaders. I.e.,
Class.forName() always looks at the classloader of the calling class and its
parents so it cannot load a class comming from a sibling. 

Of course, this only works if we are using 1.2. May be there is a way to
define this support dependant on the JVM's spec version.

Jose Alberto

> -----Original Message-----
> From: Vitaly Stulsky [mailto:vitaly_stulsky@yahoo.com]
> Sent: Wednesday, August 09, 2000 3:54 PM
> To: ant-dev@jakarta.apache.org
> Subject: Re: ClassLoader ?
> 
> 
> As far as I understood the difference is in which ClassLoader 
> space 'blah'
> will be loaded. If you use *only* system class loader there is no
> difference,
> if you use your own class loaders you can drop into the 
> problem (for example
> with security), cause first method loads class in the 
> namespace of system
> (bootstrap)
> class loader, second in the namespace of class from the left 
> of .getClass().
> 
> And long awaited link:
> http://www.artima.com/insidejvm/ed2/index.html
> Read chapter 3,7 and 8 ... or better buy the book and read it.
> 
> Vitaly Stulsky
> 
> 
> ----- Original Message -----
> From: David Weller <dgweller@yahoo.com>
> To: <ant-dev@jakarta.apache.org>
> Sent: Wednesday, August 09, 2000 12:18 PM
> Subject: Re: ClassLoader ?
> 
> 
> > > are either JVM specific or that brake tools. Many tools are
> > > broken by adding classloaders because they use
> > > Class.forName("blah") rather than
> > > getClass().loadClass("blah").
> > >
> >
> > Pete,
> > Can you cite some references for this (preferring loadClass() over
> forName())?
> >
> > I'm intrigued about the differences, because they both seem to be
> extremely
> > similar.
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Kick off your party with Yahoo! Invites.
> > http://invites.yahoo.com/
> 

Mime
View raw message