private static void visitDirectory(ClassVisitor visitor, URLClassLoader cldr, 
            String classpath_entry, File dir, String visiting_classpath) {
        if(!dir.canRead())
            return;
        for(File f : dir.listFiles()) {
            if(!f.canRead())
                continue;
            String fname = f.getName();
            if(f.isDirectory()) {
                // found a directory. recursively traverse the directory and
                // search for .class files
                if(fname.contains("."))
                    continue;

                visitDirectory(visitor, cldr, classpath_entry, f, fname + ".");
            } else if(f.isFile() && fname.endsWith(".class")) {
                // found a .class file.  Construct its full classname and pass
                // it to the class visitor
                String cn = visiting_classpath + fname.substring(0, fname.length()-6);
                try {
                    Class cls = cldr.loadClass(cn);
                    if (cls != null)
                        visitor.classFound(classpath_entry, cls);
                } catch (Throwable ex) { }
            }
        }
    }