无法在intellij IDE中的scala中找到或加载主类 [英] Could not find or load main class in scala in intellij IDE

查看:876
本文介绍了无法在intellij IDE中的scala中找到或加载主类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索过这个错误,但答案是Java,
,但我的情况是Scala。我试图在IntelliJ IDE


$ b添加sbt任务后$ b

更新2



更新3
我的问题是通过导入项目解决的,而不是直接从GitHub获取,可能是Mike Allen说的可以解决问题的手动配置,但我无法成功申请那个。

解决方案

可能你输入的项目有点不对劲。我看到scala文件夹没有突出显示为源。
通常,您甚至不需要为Scala SBT项目手动设置运行配置。 您的IDE中是否有Scala和SBT插件?



您应该通过导入项目打开SBT项目并选择build.sbt文件。我还建议启用自动导入来安装所有依赖项。



这就是我的看法:



如果您仍想手动制作,您的配置应该有效。这是我的运行配置有效:



< img src =https://i.stack.imgur.com/juhE0.pngalt =我的跑步配置>


I have searched for this error, but the answers were for Java, but my case is Scala. I am trying to run this project in IntelliJ IDE sentimenAnalysis, but it throws an error. This is also the structure of the project. Class Not found

Update 1 According to answers, Adding $ at the end of the name of search class

Update 2 after adding sbt task:

Update 3 My problem was resolved by importing the project, instead of getting it directly from GitHub, probably the manual configuration that Mike Allen said could resolve the problem, but I couldn't successfully apply that.

解决方案

Probably you imported project somehow wrong. I see scala folder is not highlighted as sources. Usually, you don't even need to setup Run configuration manually for Scala SBT project. Do you have Scala and SBT Plugins in your IDE?

You should open SBT projects through "Import project" and choose "build.sbt" file. I would also recommend enabling auto-import to install all of the dependicies.

That's how it look for me:

If you still wanna make it manually your configuration should work. That's my Run configuration that works:

这篇关于无法在intellij IDE中的scala中找到或加载主类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆