Java Eclipse 控制台不显示输出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27632355/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse Console not showing output
提问by user3497430
I have written a simple class having an SOP statement for "Hello World". But the Eclipse console is not showing output. I then wrote the same program in a previously created project and it worked fine. I am opening the Console as given below:
我编写了一个简单的类,其中包含“Hello World”的 SOP 语句。但是 Eclipse 控制台没有显示输出。然后我在以前创建的项目中编写了相同的程序,并且运行良好。我正在打开控制台,如下所示:
Window->Show View->Console.
窗口->显示视图->控制台。
But it is not working. I am using j2ee project in the same workspace. Any idea? Please help. I am stuck because of this problem.
但它不起作用。我在同一个工作区中使用 j2ee 项目。任何的想法?请帮忙。由于这个问题,我被卡住了。
回答by Rakesh KR
Make sure that the project structure should be as follows:
确保项目结构应如下所示:
回答by Elliott Frisch
Go to "Window > Reset Perspective", that will reset the window settings to default. Next, you might need to stop any running Java processes. I suggest you then click "Remove all Terminated Launches" and if the red "Terminate All" is still available click that as well
转到“窗口>重置透视”,这会将窗口设置重置为默认值。接下来,您可能需要停止任何正在运行的 Java 进程。我建议您然后单击“删除所有终止的启动”,如果红色的“终止所有”仍然可用,请单击它
回答by Anton Kolyaev
Make sure that your System.out.println("Hello World") is in mainmethod with proper signature.
确保您的 System.out.println("Hello World") 在具有正确签名的main方法中。
Ex:
前任:
public static void main(String[] args){
System.out.println("Hello World");
}
回答by Taaha Rauf
I had the same problem just figured out the solution. Just check your main method it would be
我遇到了同样的问题,只是想出了解决方案。只需检查您的主要方法即可
public void main(String[] args){
just change it to this:
只需将其更改为:
public static void main(String[] args){
回答by jbn1981
I had the same problem using jre7. Changed to jdk 1.7 and Eclipse console started showing outputs again.
我在使用 jre7 时遇到了同样的问题。更改为 jdk 1.7,Eclipse 控制台再次开始显示输出。
回答by S.H.Kashani
- Just right click on console window and click Terminate /Disconnect all.
- Run the class again
- Done !!!
- 只需右键单击控制台窗口,然后单击Terminate /Disconnect all。
- 再次运行课程
- 完毕 !!!
回答by Rahat Rajdev
[working] I encountered the same problem, I tried with all the solutions provided above but it didn't work then I came to a solution which worked. Follow the following process to overcome the problem.
[工作] 我遇到了同样的问题,我尝试了上面提供的所有解决方案,但没有用,然后我找到了一个有效的解决方案。请按照以下过程解决该问题。
Right click on workspace provided by Eclipse --> Select "Run As" --> Java Application.
右键单击 Eclipse 提供的工作区 --> 选择“运行方式” --> Java 应用程序。
This will work definitely.
这肯定会奏效。
回答by Hans
None of the above. What helped in my case:
以上都不是。什么对我有帮助:
Run> Run configurations> Common> uncheckLaunch in background(last tab all the way at the bottom).
运行>运行配置>通用>取消选中在后台启动(最后一个选项卡一直在底部)。
Then it showed the error why the thing wouldnt start.
然后它显示了为什么事情不会启动的错误。
In my case: a project dependency to a project which I had closed.
就我而言:项目依赖于我已关闭的项目。
See (rightclick) Project> Build path> Configure build path.
请参阅(右键单击)项目>构建路径>配置构建路径。
回答by Aabid Ansar
Click on Helps on the top bar. then click on Check for Updates. And update whatever updates are generated for your IDE. Helps> Check for Updates > ....
单击顶部栏中的帮助。然后点击检查更新。并更新为您的 IDE 生成的任何更新。帮助>检查更新> ....
Hope it will fix your problem.
希望它能解决你的问题。
回答by Rahul
Double-check you actually saved your file. Many of us forget to save the file and simply hit run.
仔细检查您是否确实保存了文件。我们中的许多人忘记保存文件并直接点击运行。