private static InputStream findStreamInClasspathOrFileSystem ( String fn ) throws FileNotFoundException { // ms 10-04-2010: // - even though this may look like a regular file, it may be a path inside a jar in the CLASSPATH // - check for this first. This takes precedence over the file system. InputStream is = IOUtils . class . getClassLoader ( ) . getResourceAsStream ( fn ) ; // if not found in the CLASSPATH, load from the file system if ( is == null ) is = new FileInputStream ( fn ) ; return is ; }
Locates this file either in the CLASSPATH or in the file system . The CLASSPATH takes priority