如何将Eclipse输出std:out到标准的Windows控制台

时间:2022-10-24 20:46:54

As eclipse users know, eclipse captures the output of std out and err by default and dumps it into the console that is integrated with the IDE.

正如eclipse用户所知,eclipse默认捕获std out和err的输出,并将其转储到与IDE集成的控制台中。

I would like eclipse to just use a standard windows cmd instance to display std:out and std:err by default, the way most other IDE's do. Does anybody know how to set this up?

我想eclipse只是使用标准的windows cmd实例来默认显示std:out和std:err,就像大多数其他IDE一样。有人知道如何设置吗?

4 个解决方案

#1


10  

I don't know if it's possible to redirect to a proper console window, however it can redirect to a file (which is more useful IMHO) - under Run/Debug settings -> Common -> Standard Input and Output (it can even write to console and file at the same time).

我不知道是否可以重定向到正确的控制台窗口,但它可以重定向到一个文件(这是更有用的恕我直言) - 在运行/调试设置 - >通用 - >标准输入和输出(它甚至可以写同时控制和控制文件)。

#2


0  

Well, you could probably extend/replace the existing Console view and add an option to write to stdout/stderr.

好吧,你可以扩展/替换现有的Console视图并添加一个选项来写入stdout / stderr。

If you're talking about a Java-program and you want it to open a new console window for stdout/stderr, you will probably have to modify the JDT launcher.

如果您正在讨论Java程序并且希望它为stdout / stderr打开一个新的控制台窗口,则可能需要修改JDT启动程序。

Why would you want to do that? I find it much more convenient to have stdout/stderr in the Eclipse console.

你为什么想这么做?我发现在Eclipse控制台中使用stdout / stderr会更方便。

#3


-1  

Since you haven't said why you prefer stdout in a windows cmd window i'll make some assumptions: - you only want to move the window around outside of Eclipse

既然你没有说明为什么你喜欢在windows cmd窗口中使用stdout,我会做一些假设: - 你只想在Eclipse外面移动窗口

In the case above you can drag the console window by the tab outside of Eclispe and you open another window you can move around like a cmd prompt.

在上面的例子中,您可以通过Eclispe外部的选项卡拖动控制台窗口,然后打开另一个窗口,您可以像cmd提示一样移动。

#4


-1  

When you run a java .class from the cmd it automatically outputs to the windows CMD. Either grab the most recent .class file from your bin folder or compile it yourself using javac. then just go to the windows cmd where the class file is and run it using java yourClassesName.class and it will automatically write all output to the windows cmd.

当您从cmd运行java .class时,它会自动输出到Windows CMD。从bin文件夹中获取最新的.class文件或使用javac自行编译。然后只需转到类文件所在的windows cmd并使用java yourClassesName.class运行它,它会自动将所有输出写入windows cmd。

#1


10  

I don't know if it's possible to redirect to a proper console window, however it can redirect to a file (which is more useful IMHO) - under Run/Debug settings -> Common -> Standard Input and Output (it can even write to console and file at the same time).

我不知道是否可以重定向到正确的控制台窗口,但它可以重定向到一个文件(这是更有用的恕我直言) - 在运行/调试设置 - >通用 - >标准输入和输出(它甚至可以写同时控制和控制文件)。

#2


0  

Well, you could probably extend/replace the existing Console view and add an option to write to stdout/stderr.

好吧,你可以扩展/替换现有的Console视图并添加一个选项来写入stdout / stderr。

If you're talking about a Java-program and you want it to open a new console window for stdout/stderr, you will probably have to modify the JDT launcher.

如果您正在讨论Java程序并且希望它为stdout / stderr打开一个新的控制台窗口,则可能需要修改JDT启动程序。

Why would you want to do that? I find it much more convenient to have stdout/stderr in the Eclipse console.

你为什么想这么做?我发现在Eclipse控制台中使用stdout / stderr会更方便。

#3


-1  

Since you haven't said why you prefer stdout in a windows cmd window i'll make some assumptions: - you only want to move the window around outside of Eclipse

既然你没有说明为什么你喜欢在windows cmd窗口中使用stdout,我会做一些假设: - 你只想在Eclipse外面移动窗口

In the case above you can drag the console window by the tab outside of Eclispe and you open another window you can move around like a cmd prompt.

在上面的例子中,您可以通过Eclispe外部的选项卡拖动控制台窗口,然后打开另一个窗口,您可以像cmd提示一样移动。

#4


-1  

When you run a java .class from the cmd it automatically outputs to the windows CMD. Either grab the most recent .class file from your bin folder or compile it yourself using javac. then just go to the windows cmd where the class file is and run it using java yourClassesName.class and it will automatically write all output to the windows cmd.

当您从cmd运行java .class时,它会自动输出到Windows CMD。从bin文件夹中获取最新的.class文件或使用javac自行编译。然后只需转到类文件所在的windows cmd并使用java yourClassesName.class运行它,它会自动将所有输出写入windows cmd。