commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Tanneberger <>
Subject [exec] redirect output via command
Date Thu, 12 Aug 2010 22:00:38 GMT
Hi All,

while I am playing with Apache Common Exec I found out that is it
obviously not possible to redirect output into a file via command. I
want to exec cksum file > file.chsum.txt. I get the output of cksum in
ecplise but it is not written to disk.

public static String CHKSUM_CMD2 = "cksum \"${FILE_NAME}\" > out.txt";
HashMap<String, String> options = new HashMap<String, String>();
CommandLine commandLine = CommandLine.parse(CHKSUM_CMD2);
options.put("FILE_NAME", fileName);
DefaultExecutor executor = new DefaultExecutor();

I suppose that I have to capture the output and write it to disk
afterwards. Or is there other solution ahead?

Many thx, Thomas

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message