protected ClassLoader createChildClassLoader(String name, File dir, ClassLoader parentClassLoader) throws MalformedURLException { List urls = new ArrayList(); if (verbose) { try { log.info("Adding to classpath: " + dir.getCanonicalPath()); } catch (Exception e) { } } File[] files = dir.listFiles(); if (files != null) { for (int j = 0; j < files.length; j++) { if (files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar")) { if (verbose) { try { log.info("Adding to classpath: " + name + " jar: " + files[j].getCanonicalPath()); } catch (Exception e) { } } urls.add(files[j].toURL()); } } } URL u[] = new URL[urls.size()]; urls.toArray(u); return new NamedClassLoader(name + ".ClassLoader", u, parentClassLoader); }