public static InputStream openSystemFile(String filename) throws FileNotFoundException {
  try {
    return new FileInputStream(filename);
  }
 catch (  FileNotFoundException e) {
    String resname=filename.replace(File.separatorChar,'/');
    InputStream result=ClassLoader.getSystemResourceAsStream(resname);
    if (result == null) {
      throw e;
    }
    return result;
  }
}

public static InputStream openSystemFile ( String filename ) throws FileNotFoundException { try { return new FileInputStream ( filename ) ; } catch ( FileNotFoundException e ) { String resname = filename . replace ( File . separatorChar , '/' ) ; InputStream result = ClassLoader . getSystemResourceAsStream ( resname ) ; if ( result == null ) { throw e ; } return result ; } }
try to open a file , first trying the file system , then falling back to the classpath .
