#27 Use getClass().getClassLoader() to load classes

closed-fixed
None
5
2010-03-22
2009-08-25
No

As it works much better in Eclipse bundle environments which rely heavily on ClassLoaders... they are bundle based, making Class.forName() fail generally...

You can simply patch all Class.forName(foo) into either:

1. this.getClass().getClassLoader().loadClass(foo)
2. FooClassWithStaticMethod.class.getClassLoader().loadClass(foo)

depending on whether you are in a static method (2) or not (1).

Discussion

  • nhfechner

    nhfechner - 2009-10-26

    I fixed all Class.forName occurences accordingly.

     
  • nhfechner

    nhfechner - 2009-10-26
    • assigned_to: nobody --> nhfechner
    • status: open --> open-fixed
     
  • nhfechner

    nhfechner - 2010-03-22
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.