score:5
Accepted answer
the main function needs to be inside an object, not a class definition. so instead of this
package main_function_test
class exm {
def main(args: array[string]): unit = {
println("hello world")
}
}
write this:
package main_function_test
object exm {
def main(args: array[string]): unit = {
println("hello world")
}
}
Source: stackoverflow.com
Related Query
- Error in running Scala Program: Main method not found in class main, please define the main method
- Spark Scala Error - Error: Main method not found in class
- Scala IDE Error: Main method not found in class 'hello'
- main class not found in spark scala program
- Error when running Scala project - class scala.deprecatedInheritance in compiler mirror not found
- Main class not found error while creating Maven Project in Scala IDE
- Error running scala console. Module not found
- Scala IDE Error -could not find/load main class
- Scala Main Class not found in Eclipse ide
- class not found error - scala
- Scala: Main method not found in class
- Why Scala reports error if does not specify this.type when using chain method in inherited class
- Getting an error in intellij referencing a scala method I'm not actually using in a class I have used
- Class Not Found running Scala in IntelliJ SBT project
- Error when building Scala Maven project: Could not find or load main class scala_maven_executions.MainWithArgsInFile
- scala Ide Not identifying my class as main method
- Running tests on Intellij: Class not found
- Could not find or load main class in scala in intellij IDE
- reduceByKey method not being found in Scala Spark
- Why am I getting this error when running Scala 2.13 tests in IntelliJ, but not with Scala 2.12?
- Scala Error: Could not find or load main class in both Scala IDE and Eclipse
- How to call main method of a Scala program from the main method of a java program?
- object scala in compiler mirror not found - running Scala compiler programmatically
- In Scala static value initialization does not appear to be happening before the main method is called
- protected method that takes an abstract super class instance and the "access to protected method not permitted" error
- Error on scala class : recursive method printExpr needs result type
- Scala deserialization: class not found
- Spark Scala getting class not found scala.Any
- Main method is not called in Scala script
- Compiler Error : com.sun.tools.javac.code.Symbol$CompletionFailure: class file for akka.actor.SupervisorStrategy$1 not found
More Query from same tag
- Asynchronous behavior testing akka
- remove list elements in a dataframe in scala
- Functional style for this multi-task Action
- How to get a reference to the actor instance that runs a function?
- How can I make this Scala function (a "flatMap" variant) tail recursive?
- SBT 0.13.0 - can't expand macros compiled by previous versions of Scala
- Scala from command line RichInt NoClassDefFoundError
- SBT gives "class file has wrong version 51.0, should be 49.0" when compiling a mixed project?
- Why does my clone fail in Scala?
- Scala akka-http client Timeout error
- Difference between fields of tail and head sub-lists of the list: java.lang.IndexOutOfBoundsException: 0
- log4j2 in scala on sbt complie gives Unresolved dependencies path
- Is it possible in Scala to make a function that disallows the use of closures?
- Fold on Option vs Fold on Collection
- how to get the row corresponding to the minimum value of some column in spark scala dataframe
- Unable to instantiate external Hive Metastore in Postgres / driver not found in classpath
- LWJGL and Scala, drawing an object
- How to replace id type by type parameter in this slick generic DAO trait?
- Why scala's pattern maching does not work in for loops for type matching?
- How to get the current server request timeout in Akka HTTP
- Embedding XML (and other languages?) in Scala
- Is it possible for a macro on an abstract class or trait to be applied to all subclasses?
- I deleted the .sbt directory in accident, How to make the sbt run again?
- Hadoop aws and spark incompatibilities
- Extract HttpServletRequest from akka-http
- Akka Http - Host Level Client Side API Source.queue pattern
- Can gatling load test SQL database or MongoDB?
- scala: get column name corresponding to max column value from variable columns list
- Fs2 how to fold then append to a Stream
- Benefits and drawbacks of using Hive Warehouse Connector over Hadoop File Location