URL jarFileURL = new URL("file:" + jarFileName); URLClassLoader cl = new URLClassLoader(new URL[]{jarFileURL});
ArrayList<URL> urlList = new ArrayList<URL>(); urlList.add(new URL("file:" + jarFileName)); if (classpath != null) { StringTokenizer tok = new StringTokenizer(classpath, File.pathSeparator); while (tok.hasMoreTokens()) { urlList.add(new URL("file:" + tok.nextToken())); } }  ClassLoader cl = new URLClassLoader(urlList.toArray(new URL[0]));
	public TestSuite buildTestSuite() throws Exception {		TestSuite suite = new TestSuite();		URL jarFileURL = new URL("file:" + jarFileName);		URLClassLoader cl = new URLClassLoader(new URL[]{jarFileURL});		Class testCaseClass = cl.loadClass("junit.framework.TestCase");		JarFile jarFile = new JarFile(jarFileName);		Enumeration e = jarFile.entries();		while (e.hasMoreElements()) {			JarEntry entry = (JarEntry) e.nextElement();			String entryName = entry.getName();			if (entryName.endsWith(".class")) {				String className =					entryName.substring(0, entryName.length() - ".class".length()).replace('/', '.');				Class jarClass = cl.loadClass(className);				if (testCaseClass.isAssignableFrom(jarClass))					suite.addTestSuite(jarClass);			}		}		return suite;	}