Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editor does not contain a main type

Tags:

eclipse

scala

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

Here's the code: http://www.scala-lang.org/node/45. 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?

like image 791
Helen Neely Avatar asked Jul 11 '09 13:07

Helen Neely


People also ask

What is editor does not contain a main type?

Basically, this type of Error means your Editor is not able to find the “main” method in any of your current program classes. The editor shows this error because when you want to run the project, at that time, the interpreter couldn't find the main function to start the execution of the program.

What is main type?

MainType is a powerful but easy to use font manager and font viewer for Windows, that takes the frustration out of managing your fonts. It is packed with tons of intuitive features that makes it simple to find, preview, organize, install, and print your fonts.


2 Answers

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.

like image 114
milkplus Avatar answered Sep 23 '22 23:09

milkplus


I have this problem a lot with Eclipse and Scala. It helps if you clean your workspace and rebuild your Project.

Sometimes Eclipse doesn't recognize correctly which files it has to recompile :(

Edit: The Code runs fine in Eclipse

like image 36
nuriaion Avatar answered Sep 23 '22 23:09

nuriaion