Scala错误:无法在Scala IDE和Eclipse中找到或加载主类 [英] Scala Error: Could not find or load main class in both Scala IDE and Eclipse
问题描述
这是我的问题,我知道有很多类似问题的答案,但是在我尝试之后它们都没有奏效。我正在使用Scala IDE 4.6和eclipse Oxygen来运行代码,所有这些错误都失败了。
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.
这是我的scala编译器配置:
Here's my scala compiler configuration:
这是我的运行配置:
这是我的代码,文件结构和错误显示在控制台中:
Here is my code, file structure and error showed in console:
以下是信息问题控制台:
Here is the information Problem console:
从在线答案,我已经尝试在构建之前清理项目,我也尝试了所有版本的JVM和Scala编译器,所有这些都无济于事。
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.
推荐答案
我认为这应该是你的文件夹结构
I think this should be your folder structure
Scala0
└── src
└── main
└── scala
└── com.ks.sparkscala
└── FriendsByAge
在你的情况下,在src中创建一个文件夹main / scala并将包复制到里面它。
In your case create a folder main/scala inside src and copy the package inside it.
请关注这里项目结构
我希望这有帮助!
这篇关于Scala错误:无法在Scala IDE和Eclipse中找到或加载主类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!