Scala Error: Could not find or load main class in both Scala IDE and Eclipse

孤者浪人 提交于 2019-11-28 12:09:13

I think this should be your folder structure

Scala0
└── src
    └── main
        └── scala
            └── com.ks.sparkscala
                └── FriendsByAge

In your case create a folder main/scala inside src and copy the package inside it.

Please follow here for the project structure

I hope this helped!

For Intellij IDE, use the following procedure:

  1. Go to the drop down at right top of window and select "Edit Configuration".

  2. On the pop-up screen, select "Scala-console" in left side, and in the right side, select your module name under "Use class path and SDK of module.

In the eclipse -->project properties-->scala compiler ---> change the scala installation.

It is working for me .

As far I can see your package structure is com.ks.sparkscala which is different from the declared one in FriendsByAge.scala, com.sundogsoftware.spark Hope this helps.

I had a similar problem. I’ve got Could not find or load main class in IJIdea IU-182.4892.20 / Scala 2.13 for .scala file with such structure:

package ...

import ...

object Main extends App {
...
}

//other traits, classes, objects

But when I moved //other traits, classes, objects to the separate .scala file in the same package my problem was solved.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!