score:7
your main must take an array of string. it currently takes a single string
from scala's official website :
object helloworld {
def main(args: array[string]): unit = {
println("hello, world!")
}
}
https://www.scala-lang.org/documentation/getting-started.html
also, make sure you are using the "run as scala application" option in eclipse.
score:0
in my case i had both a companion object and a class with the same name, which is normally okay in scala but appears to have confused java.
renaming either the object or class to a different name solved the problem.
score:1
this may not help each and everyone, but i did face the same issue, i cleaned the project and it worked!!!
score:1
in my case (intellij ultimate 2018.1), i had a test with the same name than the object with the main method:
src/main/scala/com/xx/xx/myapp
src/test/scala/com/xx/xx/myapp
when tried to dun main...myapp failed with the exception in this question.
just renamed src/test/scala/com/xx/xx/myapp
to myapptest
score:2
you have a class with tha same name in tests.
check that your test folder does not contain object hello.
check yuor test package for unique object names.
after renaming, problem must be solved.
there is no difference how to implement main
method. you can do like this:
object hello {
def main(args: string) = {
println("hello world!");
}
}
or like this:
object hello extends app {
println("hello world!");
}
```
Source: stackoverflow.com
Related Query
- Scala IDE Error: Main method not found in class 'hello'
- Error in running Scala Program: Main method not found in class main, please define the main method
- Main class not found error while creating Maven Project in Scala IDE
- Spark Scala Error - Error: Main method not found in class
- Scala IDE Error -could not find/load main class
- Scala Main Class not found in Eclipse ide
- scala Ide Not identifying my class as main method
- 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
- 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
- main class not found in spark scala program
- Error when running Scala project - class scala.deprecatedInheritance in compiler mirror not found
- Error when building Scala Maven project: Could not find or load main class scala_maven_executions.MainWithArgsInFile
- ubuntu scala ide - spark - toDF Method error value toDF is not a member of org.apache.spark.rdd.RDD[String]
- reduceByKey method not being found in Scala Spark
- Scala IDE error - "projectname" is not a Scala project -
- 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
- Error running scala console. Module not found
- Scala deserialization: class not found
- Spark Scala getting class not found scala.Any
- Main method is not called in Scala script
- Renaming a .scala file in Scala IDE does not rename the class
- Compiler Error : com.sun.tools.javac.code.Symbol$CompletionFailure: class file for akka.actor.SupervisorStrategy$1 not found
- Scala case class is not matched in receive method (in akka actors)
- Compile error in scala template while passing an arraylist: Not found value
More Query from same tag
- Spark/Scala: Remove some component from a DataFrame with Array typed column
- NoClassDefFoundError using Scala class from Java
- Parsing view results from CouchDB in Spark/Scala
- play-scala and zenContact app
- Compare the values in multiple columns in one Dataframe with multiple rows in one single column for target dataframe for the same record in Scala?
- Enabling Migration Warnings
- In Scala, why 'case object' and not just 'object'?
- Cannot resolve symbol norm
- AKKA: Communicating via Messaging Queue
- Scalaz iteratees: "Lifting" `EnumeratorT` to match `IterateeT` for a "bigger" monad
- Filtering values on right side of scalaz disjunction
- Is there a Scala operator similar to Haskell's $ (dollar sign)?
- Use nullable instead of Option?
- Better way to check if a pattern is matching (not regex)
- Is there an equivalent of junit test suite in Scala
- Getting Scala type bound error: not found: type <%<
- How to replace \\ in a string with \ in scala?
- Scala type class to extend generic type: No implicits found for parameter
- Playframework Closure Compiler concatenates javascript in the wrong order
- Akka: persist to Cassandra and publish to Kafka multiple events
- Bad Symbolic reference to reactivemongo.api.collections.GenericHandlers encountered in class file 'JSONGenericHandlers.class'
- reading header of each part in multipart request in Scala Play
- Generating Json string using Json4S from a list containing Some and None values
- Scala: Generic Implicit class
- Load to BigQuery Via Spark Job Fails with an Exception for Multiple sources found for parquet
- Actor pool in scala
- Does scala play 1.2.4 have compatibility with postgres?
- Implement a Verilog $onehot task in Chisel
- Akka Http Test Gzip Response
- What should be the href of a collection response if I am getting one single item of that collection?