code: public static Set<Class<?>> getFromJarFile(final ClassLoader loader, final String jar, final String packageName, final boolean
                                                                                                                           mapSubPackages)
          throws IOException, ClassNotFoundException {
          final Set<Class<?>> classes = new HashSet<Class<?>>();
          final JarInputStream jarFile = new JarInputStream(new FileInputStream(jar));
          try {
              JarEntry jarEntry;
              do {
                  jarEntry = jarFile.getNextJarEntry();
                  if (jarEntry != null) {
                      String className = jarEntry.getName();
                      if (className.endsWith(".class")) {
                          String classPackageName = getPackageName(className);
                          if (classPackageName.equals(packageName) || (mapSubPackages && isSubPackage(classPackageName, packageName))) {
                              className = stripFilenameExtension(className);
                              classes.add(Class.forName(className.replace('/', '.'), true, loader));
                          }
                      }
                  }
              } while (jarEntry != null);
          } finally {
              jarFile.close();
          }
          return classes;
      }
docs: Returns the classes in a package found in a jar
  
  @param loader         the ClassLoader to use
  @param jar            the jar to scan
  @param packageName    the package to scan
  @param mapSubPackages whether to map the sub-packages while scanning
  @return the list of classes
  @throws IOException            thrown if an error is encountered scanning packages
  @throws ClassNotFoundException thrown if a class can not be found
  @morphia.internal