d2marcelo
asked on
Tar file from Java
Does anybody know how to tar a file using ant tasks org.apache.tools.ant.taskd efs.Tar..?
Thanks tons.
Thanks tons.
ASKER
thanks objects,
here is my code
Tar t = new Tar();
t.setBasedir(new File("c:\\test"));
t.setDestFile(new File("c:\\test.tar"));
t.execute();
I get
Exception in thread "main" java.lang.NullPointerExcep tion
at org.apache.tools.ant.types .AbstractF ileSet.set upDirector yScanner(A bstractFil eSet.java: 382)
at org.apache.tools.ant.types .AbstractF ileSet.get DirectoryS canner(Abs tractFileS et.java:35 6)
at org.apache.tools.ant.taskd efs.Tar$Ta rFileSet.g etFiles(Ta r.java:473 )
at org.apache.tools.ant.taskd efs.Tar.ex ecute(Tar. java:231)
here is my code
Tar t = new Tar();
t.setBasedir(new File("c:\\test"));
t.setDestFile(new File("c:\\test.tar"));
t.execute();
I get
Exception in thread "main" java.lang.NullPointerExcep
at org.apache.tools.ant.types
at org.apache.tools.ant.types
at org.apache.tools.ant.taskd
at org.apache.tools.ant.taskd
I've always used trustice package http://www.trustice.com/java/tar/
you'll probably need to give it some context to use it outside ant, will check and get back top you.
you'll probably need to give it some context to use it outside ant, will check and get back top you.
ASKER
objects,
do you use the TarArchive ? if so , do you have an example?
thanks
do you use the TarArchive ? if so , do you have an example?
thanks
ASKER
thanks objets, that works,
but would you happen to know how to use TarGzOutputStream? to compress it.
but would you happen to know how to use TarGzOutputStream? to compress it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is great.!! thanks again..
http://ant.apache.org/manual/CoreTasks/tar.html