David
David

Reputation: 11

eror when get eclipse : Exception in thread "main" java.lang.Error

I created a new java project in Eclipse, then created a new class in it and write this codes in it:

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

This problem occurres when I run my project:

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

Upvotes: 0

Views: 730

Answers (2)

Felix Gerber
Felix Gerber

Reputation: 1651

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

Changing your code to this should fix your Problem.

A Little hint: Always fix your compilation problems. Eclipse show them to you with red underlined as you can see here:

enter image description here

Eclipse also warns you if you try to start an porject within erros. (except your disabled it). Don't ignore those warnings.

Hope that helps!

Upvotes: 2

Rahman
Rahman

Reputation: 3785

Java is case sensitive and correct spelling of system is System not system

Upvotes: 2

Related Questions