Editor does not contain a main type in Eclipse [duplicate]
Problem is that your folder is not identified as a Source folder.
- Right click on the project folder -> Properties
- Choose 'Java Build Path'
- Click on 'Sources' tab on top
- Click on 'Add Folder' on the right panel
- Select your folders and apply
I just had this exact same problem. This will sound crazy but if someone sees this try this before drastic measures. delete method signature:
public static void main(String args[])
(Not the body of your main just method declaration)
Save your project then re-write the method's header back onto its respective body. Save again and re-run. That worked for me but if it doesn't work try again but clean project right before re-running.
I don't know how this fixed it but it did. Worth a shot before recreating your whole project right?
I suspect the problem is that Sample.java should be in a package inside the src folder.
I guess that eclipse will not automatically look outside of there.