return dir;
return cachedDirectory = dir;
    protected  File findDirectory(String rootPath) {        //try direct path        File dir = new File(rootPath);        StringBuffer triedPath = new StringBuffer();        appendFilePath(triedPath, dir);        if (!dir.canRead() || !dir.isDirectory()) {            //try with . parent            dir = new File(".", rootPath);            appendFilePath(triedPath, dir);            if (!dir.canRead() || !dir.isDirectory()) {                //try with / parent                dir = new File("/", rootPath);                appendFilePath(triedPath, dir);                if (!dir.canRead() || !dir.isDirectory()) {                    //trying with ressource                    URL url = FileReaderRandomBackgroundGenerator.class.getClassLoader().getResource(rootPath);                    if (url != null) {                        dir = new File(url.getFile());                        appendFilePath(triedPath, dir);                    } else {                        //trying the class path                        url = ClassLoader.getSystemClassLoader().getResource(rootPath);                        if (url != null) {                            dir = new File(url.getFile());                            appendFilePath(triedPath, dir);                        }                    }                }            }        }        //trying from system classpath        StringTokenizer token = getClasspathFromSystemProperty();        while(token.hasMoreElements()){            String path=token.nextToken();            if(!path.endsWith(".jar")){                dir = new File(path, rootPath);                appendFilePath(triedPath,dir);                if(dir.canRead()&&dir.isDirectory()){                    break;                }            }        }        if (!dir.canRead() || !dir.isDirectory()) {            throw new CaptchaException("All tried paths :'" + triedPath.toString() + "' is not" +                    " a directory or cannot be read");        }        return dir;    }