我正在编写一个 Swing 应用程序,它将执行长时间运行的 Perl 脚本。即使进程在后台执行,我也需要同时显示执行的临时输出。使用以下代码片段会在进程完成时返回输出。
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
// read the output from the command
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
如何同时获得输出?我正在使用 Swingworker 来显示返回的信息。
最佳答案
关于java - 从 Java 并发获取 Perl 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18509236/