mapreduce-protolib/src/main/java/com/streamsets/pipeline/stage/destination/mapreduce/MapreduceUtils.java
public static void addJarsToJob(Configuration conf, boolean allowMultiple, String... jarPatterns) {
    final ClassLoader loader = MapreduceUtils.class.getClassLoader();
    if (!(loader instanceof URLClassLoader)) {
      throw new IllegalStateException(String.format(
          "ClassLoader for %s is not an instance of URLClassLoader (it is %s), and thus this method cannot be used",
          MapreduceUtils.class.getCanonicalName(),
          loader.getClass().getCanonicalName()
      ));
    }
    final URLClassLoader urlClassLoader = (URLClassLoader) loader;

    addJarsToJob(conf, allowMultiple, urlClassLoader.getURLs(), jarPatterns);
  }
public static void addJarsToJob(Configuration conf, boolean allowMultiple, String... jarPatterns) {
    final ClassLoader loader = MapreduceUtils.class.getClassLoader();
    if (!(loader instanceof URLClassLoader)) {
      throw new IllegalStateException(String.format(
          "ClassLoader for %s is not an instance of URLClassLoader (it is %s), and thus this method cannot be used",
          MapreduceUtils.class.getCanonicalName(),
          loader.getClass().getCanonicalName()
      ));
    }
    final URLClassLoader urlClassLoader = (URLClassLoader) loader;

    addJarsToJob(conf, allowMultiple, urlClassLoader.getURLs(), jarPatterns);
  }
Add jars whose names contain the given patterns to the job's classpath.

Searches the {@link ClassLoader} - which must be an instance of {@link URLClassLoader} or an
{@link IllegalStateException} will be thrown - of the {@link MapreduceUtils} class itself for the jar matching
a pattern indicated each arguments.

Each supplied jarPattern is treated as a case-insensitive substring for a full jar path.  This method expects
to find at least one jar matching each substring, or an {@link IllegalArgumentException} will be thrown.  If more
than one jar is matched, then the result will depend on the allowMultiple parameter - if true, then all will be
added, while if false, an {@link IllegalArgumentException} will be thrown.

Care has <b>NOT</b> been taken to optimize the performance of this method; the runtime is M * N where M is the
number of entries on the classpath and N is the number of given jarPatterns.  It is assumed that this method
will be called infrequently and with relatively few jarPatterns.

@param conf the Hadoop conf for the MapReduce job
@param allowMultiple whether multiple matching jars are allowed to be added for a single pattern
@param jarPatterns the patterns to search for within the classpath