code: public static boolean extractArchive(File tarFile, File extractTo)
  	{
  		try
  		{
  			TarArchive ta = getArchive(tarFile);
  			try
  			{
  				if (!extractTo.exists())
  					if (!extractTo.mkdir())
  						throw new RuntimeException("Could not create extract dir: " + extractTo);
  
  				ta.extractContents(extractTo);
  			}
  			finally
  			{
  				ta.closeArchive();
  			}
  			return true;
  		}
  		catch (FileNotFoundException e)
  		{
  			log.error("File not found exception: " + e.getMessage(), e);
  			return false;
  		}
  		catch (Exception e)
  		{
  			log.error("Exception while extracting archive: " + e.getMessage(), e);
  			return false;
  		}
  	}
docs: Extracts a .tar or .tar.gz archive to a given folder
  
  @param tarFile
  File The archive file
  @param extractTo
  File The folder to extract the contents of this archive to
  
  @return boolean True if the archive was successfully extracted, otherwise false