public static URL getResource ( String resource , ClassLoader classLoader ) throws IOException { URL url = null ; if ( classLoader != null ) { url = classLoader . getResource ( resource ) ; } if ( url == null ) { url = ClassLoader . getSystemResource ( resource ) ; } if ( url == null ) { throw new IOException ( "Could not find resource '" + resource + "'" ) ; } return url ; }
Returns the URL of the resource on the classpath .