classpath
[Top][All Lists]
Advanced

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

Re: A query on the classloader architecture


From: Chris Gray
Subject: Re: A query on the classloader architecture
Date: Sun, 11 Jul 2004 23:54:16 +0200
User-agent: KMail/1.5.4

On Sunday 11 July 2004 13:50, David Holmes wrote:
> I wrote:
> > > Consequently application code should have every right to assert that
> > > "this.getClass().getClassLoader()" is never null.
>
> Jeroen responded:
> > Sure, but, IMHO, if you write a library you cannot assume that your
> > library won't be loaded by the bootstrap class loader.
>
> Good point. There's nothing stopping a user from putting everything on
> bootclasspath. I wonder how many library writers actually consider that?

Why do you think people write stuff like
   Class c;
   ClassLoader cl = this.getClass().getClassLoader();
   if (cl == null) {
     c = Class.forName(classname);
   }
   else {
     c = Class.forName(classname, false, cl);
   }

Which gets tedious, real fast. :-{

Chris

-- 
Chris Gray                      /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi        http://www.kiffer.be/k/
address@hidden                         +32 3 216 0369





reply via email to

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