public static File findFile(String filename, String rootDir) throws NotDirectoryException {

        try {
            File root = new File(rootDir);
            if (!root.isDirectory()) {
                throw new NotDirectoryException("Invalid directory");
            }
            File[] list = root.listFiles();
            for (File f : list) {
                if (f.isDirectory() ) {
                    File x = findFile(filename, f.getAbsolutePath());
                    if( x!=null){
                        return x;
                    }
                    //System.out.println("Dir:" + f.getAbsoluteFile());

                } else {
                    System.out.println("File:" + f.getAbsoluteFile());
                    if (filename.compareTo(f.getName()) == 0) {
                        System.out.println("found ------------------:" + f.getAbsoluteFile());
                        return f;
                    }

                }
            }
        } catch (Exception ex) {
            throw new NotDirectoryException("Invalid directory");
        }
        return null;

    }