commons-exec をつかってテストを書くとき、自分のローカルはwindowsなので、そこでのechoコマンドの実行にちょっとつまったのでメモ。
CommandLine command = new CommandLine("cmd")
.addArgument("/c")
.addArgument("echo")
.addArgument("test");
DefaultExecutor executor = new DefaultExecutor();
executor.execute(commandLine);
ちなみにlinuxなら
CommandLine command = new CommandLine("/bin/echo")
.addArgument("test");
参考サイト