获取eclipse时的错误:线程“main”java.lang.Error中的异常

时间:2015-11-25 13:52:32

标签: java

我在Eclipse中创建了一个新的java项目,然后在其中创建了一个新类并在其中编写了这些代码:

public class main {
    public static void main(String[] args) {
        system.out.println("hello world");
    }
}

运行项目时会出现此问题:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    system cannot be resolved
    at helloworld.main.main(main.java:7)

2 个答案:

答案 0 :(得分:2)

Java区分大小写,系统的正确拼写为System而不是system

答案 1 :(得分:2)

   package helloworld;
   public class main {
       public static void main(String[] args) {
           System.out.println("hello world");
       }
   }

将代码更改为此应解决问题。

一点提示:始终修复编译问题。 Eclipse会向您显示红色下划线,如您所见:

enter image description here

如果您尝试在erros中启动项目,Eclipse也会发出警告。 (除了你的残疾人)。不要忽视这些警告。

希望有所帮助!