Eclipse出现错误:The selection cannot be launched,and there are no recent launches

刚装了eclipse,想写个Java程序测试一下能不能用,结果一run就出现错误,Debug也是同样的错误,错误内容为:the selection cannot be launched,and there are no recent launches.由于是初学者,对于Java完全不懂,就上网搜索发现说右键项目选择run再选择run as application,发现找不到这个。

以下是代码

1 package test;
2 
3 public class test {
4 
5     static void main(String[] arg)
6     {
7         System.out.println("Hello World");
8     }
9 }

发现需要加一个public在static前,并且String的S必须为大写,并且main一定要拼写正确。改正后的代码如下

package test;

public class test {

    public static void main(String[] arg)
    {
        System.out.println("Hello World");
    }
}

发现可以运行,成功输出结果Hello World

 

2018.09.18

posted @ 2018-09-18 15:51  大大木瓜  阅读(13742)  评论(0编辑  收藏  举报