SBT Scala main class:

You can specify the main class in your build.sbt as:

mainClass in (Compile, run) := Some("org.activeintel.Driver")

Doing sbt run resulted in the following error:

[error] (run-main-0) java.lang.NoSuchMethodException: Driver.main is not static
java.lang.NoSuchMethodException: Driver.main is not static
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
 at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 2 s, completed 1-Jan-2015 10:32:34 AM

This was caused by Driver being a class rather than object; adjusting it fixed the error:

before:

class Driver {

    def main(args:Array[String]) = {

after:

object Driver {

    def main(args:Array[String]) = {

 

 

About Neil Rubens

see http://ActiveIntelligence.org

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*