code: public static void loadJARs(String directory) throws SecurityException, 
    IllegalArgumentException, IOException, NoSuchMethodException, 
    IllegalAccessException, InvocationTargetException {
      File file = new File(directory);
      if (!file.isDirectory()) {
        throw new IllegalArgumentException(
            "The path specified was not a directory");
      }
      
      ArrayList<File> jars = new ArrayList<File>();
      searchForJars(file, jars);
      if (jars.size() < 1) {
        LOG.debug("No JAR files found in path: " + directory);
        return;
      }
      
      for (File jar : jars) {
        addFile(jar);
      }
    }
docs: Recursively traverses a directory searching for files ending with .jar and
  loads them into the class path
  <p>
  <b>WARNING:</b> This can be pretty slow if you have a directory with many
  sub-directories. Keep the directory structure shallow.
  
  @param directory The directory
  @throws IOException if the directory does not exist or cannot be accessed
  @throws SecurityException if there is a security manager present and the
  operation is denied
  @throws IllegalArgumentException if the path was not a directory
  @throws NoSuchMethodException if there is an error with the class loader
  @throws IllegalAccessException if a security manager is present and the
  operation was denied
  @throws InvocationTargetException if there is an issue loading the jar