简体   繁体   English

如何将Linux终端输出重定向到Eclipse控制台?

[英]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.

相关问题 当Eclipse插件使用JNI时,如何将JNI控制台输出重定向到Eclipse Console视图? - How can I redirect JNI console output to Eclipse Console view, when Eclipse plugin uses JNI? 如何使用eclipse插件将控制台输出重定向到GUI控制台视图? - How to redirect the console output into the GUI console view using eclipse plugin? 如何让Eclipse控制台显示与终端相同的GoogleTests输出? - How to have Eclipse console show the same GoogleTests output as in the terminal? 我可以从终端进行编译时在Linux&Eclipse中进行编译 - Compiling in Linux&Eclipse when I can compile from terminal 如何仅使用Linux终端命令将Eclipse上的项目视图更改为分层视图? - How can I change project view on eclipse to hierarchical only using Linux terminal command? 如何使用 ZEDC9F0A5A5D57743831 控制台中的 CMake 构建 Eclipse C++ 项目(没有可用的 GUI) - How I can build Eclipse C++ project with CMake from the Linux console ( no GUI is available ) Eclipse-将所有记录器输出重定向到控制台 - Eclipse - redirect all logger output to console 将Play Framework 2输出重定向到Eclipse控制台 - Redirect Play Framework 2 output to Eclipse console 如何将Eclipse输出std:out到标准的Windows控制台 - How can I make Eclipse output std:out to a standard windows console 如何在Eclipse中为远程C ++输出执行显示到控制台? - How can I output execution display to console in Eclipse for remote C++?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM