score:21
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.
if you still wanna make it manually your configuration should work. that's my run configuration that works:
score:-1
score:0
had a similar problem with latest intellij idea build (2022.1.1) and scala 3.1.2 - both sbt and intellij scala projects. for me the solution was to use non-ascii path.
score:1
create a new project and make sure sbt is proper loaded along with scala library. this happens with many times, bad internet connection or failure of scala library/sbt loading might be some of the reasons. best of luck for next project, happy developers & coders.
score:2
score:3
in my case the object
in the object myobject extends app
was nested, if you have it unested meaning in your scala file it's not under any other object it made it work.
netsted caused this error in intellij:
object external {
object mymain extends app // could not find or load main class in scala in intellij ide
}
while the below unested worked:
object external { }
object mymain extends app // worked!
score:7
you will get this error if you tried to open the project and imported it incorrectly. i would open the project like this in intellij:
file>new> project from existing source>(select) import project from external model>
(select)sbt
click next>finish
score:40
my problem was resolved when i marked src folder as sourced root. click with the right button in src folder -> mark directory as -> sources root
Source: stackoverflow.com
Related Query
- Could not find or load main class in scala in intellij IDE
- Scala Error: Could not find or load main class in both Scala IDE and Eclipse
- Scala - IntelliJ IDEA Error: Could not find or load main class
- Could not find or load main class (classname) in Scala Intellij
- Intellij IDEA Error: Could not find or load main class org.jetbrains.jps.cmdline.Launcher in Scala Project
- New scala project in Intellij - Error: Could not find or load main class
- Dockerize a scala app: Could not find or load main class
- Error: Could not find or load main class Main Scala
- Kafka 8.2.0 on Scala 2.10/Windows - Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
- Error: Could not find or load main class in scala
- Scala jar: Error: Could not find or load main class
- Scala bazel Error: Could not find or load main class
- Reason and fix for "Error: Could not find or load main class Anne" on Scala Getting started tutorial
- Error when building Scala Maven project: Could not find or load main class scala_maven_executions.MainWithArgsInFile
- Gatling Error: Could not find or load main class Engine
- Scalatra could not find or load main class
- SparkSession throw Could not find or load main class
- Could not find or load main class org.scalatest.tools.Runner
- Error: Could not find or load main class with Spark in Eclipse
- Error: Could not find or load main class io.gatling.app.Gatling
- Could not find or load main class com.weekdays.claobj.Ann1
- Error: Could not find or load main class com.sundogsoftware.spark.RatingsCounte
- How to fix 'Error: Could not find or load main class' on scala application in Intellij?
- Could not find or load main class sbt-assembly executable jar
- Error: Could not find or load main class scala.tools.nsc.Main
- Could not find or load main class Platform during docker container running
- Could not find or load main class Spark Docker
- Error: Could not find or load main class com.sparkarma.spark.WordCount
- Error: Could not find or load main class Files\Eclipse Caused by: java.lang.ClassNotFoundException: Files\Eclipse
- Error: Could not find or load main class: Scala IDE/Spark
More Query from same tag
- Why DataFrame.collect() not returning array
- Scala Profiler?
- Scala: List drop first n empty items
- Inheritance in Lift Mapper or Record Framework
- Why is "ls -d */"! not working in scala?
- Spark on YARN and spark-bigquery connector
- how to create multiple chatrooms using websockets in scala?
- Executing sbt in command line via python script and outputting to file
- How to fix dreaded type mismatch required _$1 when modifying the class containing the generic is not an option?
- How can I supply a Scala+Akka+Camel SFTP (or FTP) Consumer with a list of files to fetch?
- How to convert streaming Dataset[String] to Dataset[Array[String]]?
- Best way to keep WebSocket connection alive in Akka HTTP?
- Scala Regex union
- Regarding org.apache.spark.sql.AnalysisException error when creating a jar file using Scala
- NoSuchMethodError on a Map (Spark Scala class)
- Scala: benchmark methods' speed by time: Total runtime for methods
- Mapping of String to Type
- How to make cleanup when creating a source stream from iterator with Akka stream?
- Finding implicit values in the companion object of a nested type
- Spark Scala: Need to get records with NULL dates coming on top after ordering by a different date using spark
- Scala - IntelliJ: Simple Module w/ Scala SDK vs SBT-based
- Can Scala collection's seq/par/view/force be seen as a violation of the uniform return type principle?
- Mapped projection with <> to a case class with companion object in Slick
- How to read only Successful values from a Seq of Futures
- Scala special char validation gives incorrect result
- Getting the value out of a Future in Scala
- Spark: How to configure writetime while saving to cassandra
- Spark - Update a nested column to string
- scala worksheet throwing error with spark
- flatMap in Generator from online scala course by Martin Odersky