private static Class[] getClasses(String packageName) throws ClassNotFoundException, IOException {
	     ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
	     assert classLoader != null;
	     String path = packageName.replace('.', '/');
	     Enumeration<URL> resources = classLoader.getResources(path);
	     List<File> dirs = new ArrayList<File>();
	     while (resources.hasMoreElements()) {
	    	 URL resource = resources.nextElement();
	    	 dirs.add(new File(resource.getFile()));
	     }
	     ArrayList<Class> classes = new ArrayList<Class>();
	     for (File directory : dirs) {
	    	 classes.addAll(findClasses(directory, packageName));
	     }
	     return classes.toArray(new Class[classes.size()]);
	}