简体   繁体   English

Eclipse为什么不运行我的Hello World程序?

[英]Why isn't Eclipse running my Hello World Program?

I have a simple program and when I right click on file>Run as Java Application nothing happens. 我有一个简单的程序,当我右键单击file>Run as Java Application什么都没有发生。 Here is the program but there are no errors really. 这是程序,但实际上没有错误。

public class test1{
    public static void main(String arg[]){
        System.out.println("Testing Testing!");

    }
}

Are you checking output window? 您在检查输出窗口吗? open Menu--->Window--->Show View-->Console and check 打开菜单->窗口->显示视图->控制台并检查

Mostly likely you don't have your app selected in the package explorer tree at the left. 很可能您没有在左侧的包浏览器树中选择您的应用。

Just click on the top-most item in the tree (ie. "MyFirstApp") and then try running again. 只需单击树中最上面的项目(即“ MyFirstApp”),然后尝试再次运行。 Chances are you had "activity_main.xml" selected as it's the default selection when you built your test app. 您可能已经选择了“ activity_main.xml”,因为它是构建测试应用程序时的默认选择。

Check the Eclipse console view to see if your output is shown there. 检查Eclipse控制台视图以查看是否在其中显示了输出。 If not, check your Problems view for errors. 如果不是,请检查“问题”视图中是否有错误。

If you are expecting to see a window then you would be wrong. 如果您期望看到一个窗口,那么您错了。 when you type System.out.println("Testing Testing!"); 当您键入System.out.println(“ Testing Testing!”); it will put Testing Tesing! 它将放入Testing Tesing! in the eclipse console you can know this because of the System part of your code. 在eclipse控制台中,由于代码的System部分,您可以知道这一点。

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

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