private File findFile(File directory,String name) throws FileNotFoundException {
  File file=new File(directory,name);
  if (file.exists()) {
    return file;
  }
  for (  String child : directory.list()) {
    if (child.equalsIgnoreCase(name)) {
      return new File(directory,child);
    }
  }
  throw new FileNotFoundException("Missing file: " + file);
}

private File findFile ( File directory , String name ) throws FileNotFoundException { File file = new File ( directory , name ) ; if ( file . exists ( ) ) { return file ; } for ( String child : directory . list ( ) ) { if ( child . equalsIgnoreCase ( name ) ) { return new File ( directory , child ) ; } } throw new FileNotFoundException ( "Missing file: " + file ) ; }
finds the named file in the named directory . this tries extra hard to avoid case - insensitive - naming problems , where the requested file is available in a different casing .
