public static Class[] getAllClasses(JarFile jarFile) throws ClassNotFoundException {
        notNull(jarFile, "JarFile jarFile");

        ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
        Enumeration<JarEntry> entries = jarFile.entries();
        while (entries.hasMoreElements()) {
            JarEntry entry = entries.nextElement();
            String entName = entry.getName().replace("/", ".");
            if (entName.endsWith(".class")) {
                Class<?> cls = Class.forName(entName.substring(0, entName.length() - 6));
                classes.add(cls);
            }
        }
        return classes.toArray(new Class[classes.size()]);
    }