Error: Selection does not contain a main type

user2321611 picture user2321611 · Apr 25, 2013 · Viewed 239.2k times · Source

I am trying to run some java files in a new project. So I make the project, put the files in it and I try to run the main file so my game starts.

I get an error that says selection does not contain a main type.

I have tried several ways to run it:

  • Some say to launch eclipse again, tried this a dozen times.
  • Somewhere else someone pointed to open a new project and make a build path to the old project.

Didn't work either.

I am pretty sure it must work because I ran it a few hours ago at school. How do I get this working? Thank you in advance!

Answer

Rashid picture Rashid · Apr 12, 2014

Right click on the folder where you put your main class then click on Build Path --> Use as Source Folder.

Finally run your main file as java application. Hope this problem will be solved.