Editor does not contain a main type

后端 未结 30 2153
执笔经年
执笔经年 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:33

    Have faced the similar issue, resolved this by right clicking on the main method in the outline view and run as Java application.

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

    I just had this problem too. The solution is to make sure eclipse created the project as Java project. Just create a new Java project and copy your class into the src folder (and import the eventual dependencies). This should fix the problem.

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

    For me, in Eclipse 3.6, this problem occurs when my main method is not public. I caused the problem by having a main method like this:

    static void main(String[] args) 
    

    The dubugger was unable to detect this by itself. I am pretty suprised Eclipse overlooked this.

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

    If it is maven project please check the java file is created under src/main/java

    If you are not getting please change the JRE path and create the java files in above folder structure

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

    This could be the issue with the Java Build path. Try below steps :

    1. Go to project properties
    2. Go to java Build Path
    3. Go to Source tab and add project's src folder

    This should resolve the issue.

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

    you should create your file by

    selecting on right side you will find your file name,

    under that will find src folder their you right click select -->class option

    their your file should be created

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