commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlo Camerino <carlo.camer...@gmail.com>
Subject How To Get The Output Of A Command Into A String Variable
Date Thu, 23 Dec 2010 09:36:33 GMT
Hi,

good day! is there anyway that I can get the output of a string variable

CommandLine commandLine = new CommandLine("7z");
        commandLine.addArgument("e");
        commandLine.addArgument("-psa-
emp");
        commandLine.addArgument("-y");
        commandLine.addArgument("-o<output-folder>");
        commandLine.addArgument("<file-name-of-zip>")
DefaultExecutor executor = new DefaultExecutor();
    int exitValue = executor.execute(commandLine);

i could actually see the result in the console, however, i'm trying to
find a way in which i can store the result into a string variable
since
it is a requirement to store the actual results.

Here is a sample result

Processing archive: <file-name-of-zip>

Extracting  <file-name>
Extracting  <file-name>

is there anyway that i can get the outputstream and store it into a
string variable?

thanks a lot
carlo

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message