private void populateClasses() throws JarClassLoaderException {
		File dir = new File(directory);
		File[] jars = dir.listFiles(new FileFilter() {
			public boolean accept(File file) {
				return file.isFile() && file.getName().endsWith(".jar");
			}
		});
		if (jars == null) {
			return;
		}
		byte classBytes[];
		Class<?> result = null;
		String className = null;
		JarInputStream jarFile;
		InputStream classInputStream;
		try {
			JarFile jar = null;
			for (File f : jars) {
				jar = new JarFile(directory + "/" + f.getName());
				jarFile = new JarInputStream(new FileInputStream(jar.getName()));
				JarEntry jarEntry;
				while (true) {
					jarEntry = jarFile.getNextJarEntry();
					if (jarEntry == null) {
						break;
					}
					if ((jarEntry.getName().endsWith(".class"))) {
						className = jarEntry.getName().replaceAll("/", "\\.")
								.replace(".class", "");
						classInputStream = jar.getInputStream(jarEntry);
						ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
						int nextValue = classInputStream.read();
						while (-1 != nextValue) {
							byteStream.write(nextValue);
							nextValue = classInputStream.read();
						}

						classBytes = byteStream.toByteArray();
						byteStream.close();
						result = defineClass(className, classBytes, 0,
								classBytes.length, null);
						classes.put(className, result);
						classInputStream.close();
					}
				}
				jarFile.close();
				jar.close();
			}
		} catch (Exception e) {
			throw new JarClassLoaderException(e);
		}
	}