Editor does not contain a main type

后端 未结 30 2154
执笔经年
执笔经年 2020-11-27 13:51

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/

相关标签:
30条回答
  • 2020-11-27 14:44

    run "eclipse -clean -refresh" from command line. This fixed the issue for me when all other solutions failed.

    0 讨论(0)
  • 2020-11-27 14:47

    Just make sure that the folder you work in is added to the built path:

    right-click your folder --> build Path --> Use as source Folder

    and it should now find main therein.

    0 讨论(0)
  • 2020-11-27 14:48

    What you should do is, create a Java Project, but make sure you put this file in the package file of that project, otherwise you'll encounter same error.

    enter image description here

    0 讨论(0)
  • 2020-11-27 14:49

    I have this problem too after I changed the source folder. The solution that worked for is just editing the file and save it.

    0 讨论(0)
  • 2020-11-27 14:50

    You can try to run the main function from the outline side bar of eclipse.

    solution

    0 讨论(0)
  • 2020-11-27 14:50

    File >> Import >> Existing Projects into Workspace >> Select Archive Filed >> Browse and locate file >> Finish. If its already imported some other way delete it and try it that way. I was having the same problem until i tried that.

    0 讨论(0)
提交回复
热议问题