[英]How can I redirect linux terminal output to Eclipse console?
I am trying to redirect Terminal output to Eclipse console using external tools where I specified Terminal path (for example /usr/bin/xterm
). 我试图使用我指定了终端路径的外部工具(例如/usr/bin/xterm
)将终端输出重定向到Eclipse控制台。 When I run this tool it opens Terminal outside eclipse. 当我运行此工具时,它将在eclipse外打开终端。 When I did same thing in Windows 7, setting external tool location to Windows\\System32\\cmd.exe
it ran inside Eclipse console. 当我在Windows 7中执行相同的操作时,将外部工具位置设置为Windows\\System32\\cmd.exe
它将在Eclipse控制台中运行。 I wonder how I can make Terminal (in Ubuntu 14.04) work the same way. 我不知道如何使Terminal(在Ubuntu 14.04中)以相同的方式工作。
You should use /bin/sh
as command interpreter. 您应该使用/bin/sh
作为命令解释器。
In Windows, cmd.exe
combines two functions—interpreting commands and displaying terminal window. 在Windows中, cmd.exe
结合了两个功能-解释命令和显示终端窗口。 In Unix these functions are strictly separated. 在Unix中,这些功能严格分开。 /bin/sh
interprets commands and /usr/bin/xterm
(or /usr/bin/x-terminal-emulator
) displays terminal window, inside which it runs /bin/sh
(or other shell like /bin/bash
, /bin/zsh
etc.) to interpret commands. /bin/sh
解释命令, /usr/bin/xterm
(或/usr/bin/x-terminal-emulator
)显示终端窗口,在该窗口中运行/bin/sh
(或其他shell,如/bin/bash
, /bin/zsh
等)来解释命令。
So if you ask Eclipse to run something via /usr/bin/xterm
, it will appear in a new window, because that's what XTerm does. 因此,如果您要求Eclipse通过/usr/bin/xterm
运行某些内容,它将显示在新窗口中,因为XTerm就是这样做的。 If you just want Eclipse to capture the output, ask it to run it directly via /bin/sh
. 如果只想让Eclipse捕获输出,则要求它通过/bin/sh
直接运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.