简体   繁体   English

如何让eclipse自动打开控制台?

[英]How to make eclipse open the console automatically?

How can Eclipse be made to open the console automatically when a program is run? 如何在程序运行时自动打开控制台? I can't seem to find the preference for it. 我似乎无法找到它的偏好。

Ideally, the result would be similar to the console behaviour in NetBeans, where the console will open up automatically when a program is run. 理想情况下,结果类似于NetBeans中的控制台行为,其中控制台将在程序运行时自动打开。

How can this be achieved? 怎么能实现这一目标?

the settings under console only shows these options: console下的设置仅显示以下选项:

在此输入图像描述

Edit: Suggestion from Comment The option to open the console seems to be excluded, why? 编辑:评论建议打开控制台的选项似乎被排除在外,为什么?

在此输入图像描述

Go to Preferences>Run/Debug>Perspectives and select Java Application . 转到首选项>运行/调试>透视图,然后选择Java Application Then, go to the right side and change the run perspective to Java , or make your own perspective that includes the console window. 然后,转到右侧并将运行透视图更改为Java ,或者创建包含控制台窗口的自己的透视图。 Double check that "Open the associated perspective when launching" is set to "Always", or "prompt". 仔细检查“启动时打开关联的透视图”设置为“始终”或“提示”。 I tested the settings below by running while in the debug perspective; 我在调试透视图中运行时测试了下面的设置; it switched to the Java perspective automatically. 它自动切换到Java透视图。

在此输入图像描述

The console is a view; 控制台是一个视图; a smaller part of any perspective. 任何观点的一小部分。 Because the Java perspective includes the console view, conveniently placed below your code, using the Java perspective and setting it to launch automatically will solve your problem. 因为Java透视图包括控制台视图,方便地放在代码下面,所以使用Java透视图并将其设置为自动启动将解决您的问题。

Assuming there is something being output to the console, Eclipse will open the Console automatically on running the program. 假设有一些东西输出到控制台,Eclipse将在运行程序时自动打开控制台。 Try a simple test: 尝试一个简单的测试:

public static void main(String[] args) {

    System.out.println("I'm in the console!");
}

Go to Windows→Run/Debug→Console and select both Show when program writes to standard out and Show when program writes to standard error 转到Windows→运行/调试→控制台,然后选择“当程序写入标准输出时 显示”“程序写入标准错误时显示”

Then it will pop open the Console window regardless of whether you are in the Java or Debug perspective. 然后,无论您是在Java还是Debug透视图中,它都会弹出打开控制台窗口。

  1. Open eclipse 打开日食
  2. Open console window 打开控制台窗口
  3. Right click on console window-->Preferences-->Restore defaults-->Apply and close 右键单击控制台窗口 - >首选项 - >恢复默认值 - >应用并关闭

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM