Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
463 views
in Technique[技术] by (71.8m points)

java - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...