code: public static void generateTarGz(String src, String target) throws IOException {
  		File sourceDirectory = new File(src);
  		File destinationArchive = new File(target);
  
  		String sourcePath = sourceDirectory.getAbsolutePath();
  		FileOutputStream destinationOutputStream = new FileOutputStream(destinationArchive);
  
  		TarArchiveOutputStream archiveOutputStream = new TarArchiveOutputStream(new GzipCompressorOutputStream(new BufferedOutputStream(destinationOutputStream)));
  		archiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
  
  		try {
  			Collection<File> childrenFiles = org.apache.commons.io.FileUtils.listFiles(sourceDirectory, null, true);
  			childrenFiles.remove(destinationArchive);
  
  			ArchiveEntry archiveEntry;
  			FileInputStream fileInputStream;
  			for (File childFile : childrenFiles) {
  				String childPath = childFile.getAbsolutePath();
  				String relativePath = childPath.substring((sourcePath.length() + 1), childPath.length());
  
  				relativePath = FilenameUtils.separatorsToUnix(relativePath);
  				archiveEntry = new TarArchiveEntry(childFile, relativePath);
  				fileInputStream = new FileInputStream(childFile);
  				archiveOutputStream.putArchiveEntry(archiveEntry);
  
  				try {
  					IOUtils.copy(fileInputStream, archiveOutputStream);
  				} finally {
  					IOUtils.closeQuietly(fileInputStream);
  					archiveOutputStream.closeArchiveEntry();
  				}
  			}
  		} finally {
  			IOUtils.closeQuietly(archiveOutputStream);
  		}
  	}
docs: Compress the given directory src to target tar.gz file
  @param src The source directory
  @param target The target tar.gz file
  @throws IOException