Eclipse – Editor does not contain a main type


Just going through the sample Scala code on Scala website, but encountered an annoying error when trying to run it.

Here's the code: On running it on Eclipse, I got this message 'Editor does not contain a main type' that prevents it from running.

Is there anything I need to do…i.e break that file into multiple files, or what?

Best Solution

In Eclipse, make sure you add your source folder in the project properties -> java build path -> source. Otherwise, the main() function may not be included in your project.

Related Question