if (!webappDirFile.isDirectory() || !jarsDirFile.isDirectory()) {
System.err.println("ERROR: webapp.dir and jars.dir must specify existing directories");
System.exit(-1);
}
ClassLoader cl = new StandaloneWebappClassLoader(webappDir, jarsDir, null);
// We're using the new classloader from here on out
Thread.currentThread().setContextClassLoader(cl);
// Go!
Class taskClass = cl.loadClass(taskClassName);
Runnable task = (Runnable)taskClass.newInstance();
task.run();
}