private void localizeJarForClass(Collection<String> classNames, boolean doThrow) throws IOException {
    if (CollectionUtils.isEmpty(classNames)) {
      return;
    }

    for (String className : classNames) {
      String jarPath = null;
      boolean hasException = false;
      try {
        Class<?> clazz = Class.forName(className);
        jarPath = Utilities.jarFinderGetJar(clazz);
      } catch (Throwable t) {
        if (doThrow) {
          throw (t instanceof IOException) ? (IOException)t : new IOException(t);
        }
        hasException = true;
        String err = "Cannot find a jar for [" + className + "] due to an exception (" +
            t.getMessage() + "); not packaging the jar";
        LOG.error(err);
        System.err.println(err);
      }

      if (jarPath != null) {
        rawFs.copyFromLocalFile(new Path(jarPath), libDir);
      } else if (!hasException) {
        String err = "Cannot find a jar for [" + className + "]; not packaging the jar";
        if (doThrow) {
          throw new IOException(err);
        }
        LOG.error(err);
        System.err.println(err);
      }
    }
  }
Copy auxiliary jars for the tarball.
llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/AsyncTaskCopyAuxJars.java