TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG-DEVEL:306] Linux/Java Question



Could be it's not using the path that you expect.  Better yet just use the
GZInputStream and GZOutputSteam classes in the java.util.zip package.  After
you unzip it you just need to untar the files.  I've seen a tar package out
there too, but I can't remember where offhand.

"Perry Hoekstra" <dutchman@uswest.net> writes:

> Greet the sun all,
> 
> I have a Linux/Java question.  It involves the exec() method.
> 
> I instantiated a Runtime object using java.lang.Runtime.getRuntime(). I
> am using the exec method to execute a statement at the command line.
> 
> //Gets a runtime environment for executing GUNZIP and TAR.
> Runtime rt = java.lang.Runtime.getRuntime();
> 
> //Executes GUNZIP and TAR.
> rt.exec("gunzip -c " + tarFilePath + "/" + tarFiles[i] + " | tar xvf
> -");
> 
> The statement decompresses a TAR file using GUNZIP and then extracts the
> member files from the TAR archive. When I type in the statement at the
> command line, it works to unzip and extract my files. However, when I
> run the application, the statement doesn't unzip or extract the files,
> and it doesn't throw an error either. How can I unzip and extract the
> files from a Java application?
> 
> Example Statement: gunzip -c
> /home/phoekstra/content/tta/images/001_img.tar.gz | tar xvf -
> 
> Thank you,
> 
> -- 
> Perry Hoekstra
> E-Commerce Architect
> Talent Software Services
> dutchman@mn.uswest.net
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-devel-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-devel-help@mn-linux.org
> 

-- 
Jon Schewe | http://eggplant.mtu.net/~jpschewe
For I am convinced that neither death nor life, neither angels 
nor demons, neither the present nor the future, nor any 
powers, neither height nor depth, nor anything else in all 
creation, will be able to separate us from the love of God that 
is in Christ Jesus our Lord. - Romans 8:38-39
NOTE: My first name has no 'h' in it!  Please be observant.