Create a TAR File (tarball) using Coldfusion\Java on a windows server

Rob E
Rob E used Ask the Experts™
I need to create a TAR file containing multiple files on a windows server using Coldfusion\Java. I have found lots of examples of unpacking them, but very little on creating them. I found this example of using gzip to add some text to a file and that works, but I need to add files. I'm also not 100% sure that gzip is the same thing as building a tarball. This project was assigned to me with a very short turn-around and I'm spinning my wheels so any help in the right direction is greatly appreciated:
<cfset lineBreak = chr(13) & chr(10) />
    <!--- open the sitemap file --->
    <cfset tarFilePath = "#application.imageingFolder#DTSimages\Pending\tiff.gz" />
    <!--- create streams --->
    <cfset outputStream = CreateObject("java", "").Init(
    			CreateObject("java","").Init(tarFilePath)) />
    <cfset gzipStream = CreateObject("java", "").Init(outputStream) />
    <cfsavecontent variable="siteMapHeader"><?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns=""
    <cfset siteMapFooter = "</urlset>" />
    <cfset gzipStream.write(ToString(siteMapHeader).GetBytes()) />
    <cfset gzipStream.close() />
    <cfset outputStream.close() />

Open in new window

Win Server 2012
ColdFusion 10
Java Version 1.7.0_15
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

I need to create a TAR file containing multiple files on a windows server using Coldfusion\Java
That's slightly odd - tar files are native to Unix but foreign to Windows.

You will need a special library as they are not supported in the JRE. I'm happy to work with you on this in Live ( )

Gzip is a compression method for single files
Top Expert 2016

The solution is available here:
Yes, as i said, you need (for a proper solution) a 3rd party library


It was solved by someone on another site

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial