public static Class < ? > loadClass ( String classname ) { Class < ? > c = null ; // First try a simple Class.forName() try { c = Class . forName ( classname ) ; } catch ( ClassNotFoundException e ) { } // Didn't work? Try using this class's classloader. if ( c == null ) { try { c = ReflectionUtils . class . getClassLoader ( ) . loadClass ( classname ) ; } catch ( ClassNotFoundException e ) { } } // Still didn't work? Try the thread's context classloader. if ( c == null ) { try { c = Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( classname ) ; } catch ( ClassNotFoundException e ) { } } return c ; }
Loads a class .