错误:尝试从 Eclipse 运行 spark 时无法找到或加载主类(scala ide 4.3)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35124633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:02:54  来源:igfitidea点击:

Error: Could not find or load main class while trying to run spark from eclipse(scala ide 4.3)

eclipsescalamavenapache-spark

提问by YC7

i have build the project using sbt and imported into eclipse . while trying to execute from run configuration i cannot find my main class and on running the application its prompted with the following error : could not find the main class.i have installed spark-hadoop version 1.4 and scala version 2.10.6 in the local machine also changed the scala compiler version to 2.10.6 in scala ide . The same error is produced while trying build spark from eclipse using maven . Please advice..

我已经使用 sbt 构建了项目并导入到 eclipse 中。在尝试从运行配置执行时,我找不到我的主类,并且在运行应用程序时提示以下错误:找不到主类。我在本地机器上安装了 spark-hadoop 1.4 版和 scala 2.10.6 版还在 scala ide 中将 scala 编译器版本更改为 2.10.6。尝试使用 maven 从 eclipse 构建 spark 时会产生相同的错误。请指教..

回答by Marek Dudek

Check if Your main class in on build path.

检查您的主类是否在构建路径中。

Project -> Properties -> Java Build Path -> Source tab

项目 -> 属性 -> Java 构建路径 -> 源选项卡

If not add appropriate folder(s).

如果没有添加适当的文件夹。

回答by Rahul Modak

Add the folder where classes are generated to build path -> configure build path -> java build path -> source -> "Default Output Folder" text box.

将生成类的文件夹添加到构建路径->配置构建路径->java构建路径->源->“默认输出文件夹”文本框。

回答by Ashutosh

Check if you have .scala files included in compilation path. Even if you have the source folder included, it may be possible that .scala files are not being picked up.

检查编译路径中是否包含 .scala 文件。即使您包含了源文件夹,也有可能没有选择 .scala 文件。

The following might help, I was facing the same issue and it solved the problem for me:

以下可能会有所帮助,我遇到了同样的问题,它为我解决了问题:

build path -> configure build path -> java build path -> source -> add **/*.scala in the Included section.