public static InputStream readResource ( String name ) { String classpath = System . getProperty ( "java.class.path" ) ; LOGGER . trace ( "Reading {} from classpath={}" , name , classpath ) ; ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( classLoader == null ) { throw new IllegalStateException ( "Can not obtain classloader instance from current thread" ) ; } return classLoader . getResourceAsStream ( name ) ; }
Load resource from classpath .