code: private void copyJarDependencies (State state) throws IOException {
      if (this.tmpJobDir == null) {
        throw new RuntimeException("Job directory is not created");
      }
  
      if (!state.contains(ConfigurationKeys.JOB_JAR_FILES_KEY)) {
        return;
      }
  
      // create sub-dir to save jar files
      LocalFileSystem lfs = FileSystem.getLocal(HadoopUtils.getConfFromState(state));
      Path tmpJarFileDir = new Path(this.tmpJobDir, MRCompactor.COMPACTION_JAR_SUBDIR);
      this.fs.mkdirs(tmpJarFileDir);
      state.setProp(MRCompactor.COMPACTION_JARS, tmpJarFileDir.toString());
  
      // copy jar files to hdfs
      for (String jarFile : state.getPropAsList(ConfigurationKeys.JOB_JAR_FILES_KEY)) {
        for (FileStatus status : lfs.globStatus(new Path(jarFile))) {
          Path tmpJarFile = new Path(this.fs.makeQualified(tmpJarFileDir), status.getPath().getName());
          this.fs.copyFromLocalFile(status.getPath(), tmpJarFile);
          log.info(String.format("%s will be added to classpath", tmpJarFile));
        }
      }
    }
docs: Copy dependent jars to a temporary job directory on HDFS