【发布时间】:2011-09-16 19:53:24
【问题描述】:
问题是...我正在使用 DefaultExecutor 类的 org.apache.commons.exec 库运行一个进程。像这样:
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
CommandLine cmd = new CommandLine("java");
DefaultExecutor exec = new DefaultExecutor();
exec.setExitValue(1);
exec.execute(cmd);
}
我需要使用另一个线程“运行中”输出该输出,以便将其记录到其他地方。实现这一目标的最佳方法是什么?
【问题讨论】:
标签: java multithreading logging apache-commons-exec