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 .