Re: JDK 1.2 classloader bug!

On Wed, 20 Jan 1999, Wolfgang Platzer wrote:

> 
> I think I encountered the NT JDK 1.2 classloader bug within my application.
> Can someone point me to additional information or can tell me a workaround?

    // This is a nasty kludge due to a bug in jdk1.2 on NT
    // this.cls = Class.forName(clsname, true,
    //                          this.getClass().getClassLoader());
    // works and not
    // this.cls    = Class.forName(clsname);
    // even if it is exactly the same thing :)
    // and the creation of a new object is enough to make it run...
   this.cls.newInstance();

In fact the culprit  is the native method
ClassLoader.getCallerClassLoader(); 
It doesn't work as this.getClass().getClassLoader();
The workaround  ( this.cls.newInstance(); ) work for an unknown reason!
(thanks to Thomas Kopp for this workaround that keeps jdk1.1
compatibility)
Regards,

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    

Received on Wednesday, 20 January 1999 08:29:45 UTC