Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Here is my problem, I know there are lots of answers for similar questions, however none of them worked after I tried. I'm using both Scala IDE 4.6 and eclipse Oxygen to run the code and all failed on this error.

Here's my scala compiler configuration:

scala compiler configuration

Here is my run configuration:

run configuration

Here is my code, file structure and error showed in console:

enter image description here

Here is the information Problem console:

enter image description here

From online answer, I have already tried to clean the project before building, I also tried all the versions of JVM and Scala compiler, all of those didn't help.

The code was directly import from a online course code, so I believe there shouldn't be any errors in the code.

like image 823
SKSKSKSK Avatar asked Aug 07 '17 05:08

SKSKSKSK


1 Answers

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!

like image 171
koiralo Avatar answered Sep 27 '22 17:09

koiralo