Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Tar file from Java

Posted on 2009-07-12
Medium Priority
Last Modified: 2012-05-07
Does anybody know how to tar a file using ant tasks

Thanks tons.
Question by:d2marcelo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 92

Expert Comment

ID: 24836831
the doco has lots of examples

Author Comment

ID: 24836849
thanks objects,

here is my code

       Tar t = new Tar();
      t.setBasedir(new File("c:\\test"));
      t.setDestFile(new File("c:\\test.tar"));

I get

       Exception in thread "main" java.lang.NullPointerException
LVL 92

Expert Comment

ID: 24836851
I've always used trustice package
you'll probably need to give it some context to use it outside ant, will check and get back top you.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 24836885
do you use the TarArchive ?  if so , do you have an example?

Author Comment

ID: 24837613
thanks objets, that works,
but would you happen to know how to use TarGzOutputStream? to compress it.
LVL 92

Accepted Solution

objects earned 2000 total points
ID: 24837639
theres an example here
or use a GZIPOutputStream for the output stream passed to TarArchive constructor

Author Closing Comment

ID: 31602684
This is great.!!   thanks again..

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question