public static ClassLoader getDefault ( ) { ClassLoader loader = null ; try { loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; } catch ( Exception ignored ) { } if ( loader == null ) { loader = Environment . class . getClassLoader ( ) ; if ( loader == null ) { try { // getClassLoader() returning null indicates the bootstrap ClassLoader loader = ClassLoader . getSystemClassLoader ( ) ; } catch ( Exception e ) { // Cannot access system ClassLoader - oh well, maybe the caller can live with null... } } } return loader ; }
Get current thread context ClassLoader