Editor does not contain a main type in Eclipse [duplicate]


I downloaded eclipse-jee-kepler-SR1-linux-gtk-x86_64.tar.gz. This eclipse is built-in with java and my Lubuntu is 64-bit. Whenever I compile and run a simple code in java like this one below:

public class Sample{

   public static void main(String[] args){
       System.out.println("YOLO");
   }
}

I always get an Editor does not contain a main type. I put the file in a project folder called Sample. This eclipse should compile java code because its an IDE distribution specialized for java.

How can i resolve this error?

Any help would be much appreciated.

Here's my project structure: enter image description here


Answers:


Problem is that your folder is not identified as a Source folder.

  1. Right click on the project folder -> Properties
  2. Choose 'Java Build Path'
  3. Click on 'Sources' tab on top
  4. Click on 'Add Folder' on the right panel
  5. Select your folders and apply