0

I want to create a runnable jar file from a Scala project. I install sbt on window 7. I create a file hw.scala :

object Hi {
  def main(args: Array[String]) = println("Hi!")
}

File built.sbt ( in the same directory )

    lazy val root = (project in file(".")).
      settings(
        name := "hello",
        version := "1.0",
        scalaVersion := "2.11.4"
      )

When I run "sbt run", it displays the result. After that, I run "sbt compile" then "sbt package". However when I run

java -jar target\scala-2.11\hello_2.11-1.0.jar

The consonle notice the error : java.lang.NoClassDefFoundError.

Could some one help me ?

user1000652
  • 33
  • 2
  • 12
  • I solve my problem. I add sbt assembly, which I followed the guide : https://github.com/sbt/sbt-assembly. When I run "sbt assembly", the jar file can be run – user1000652 Sep 25 '15 at 20:04

1 Answers1

0

I solve my problem. I add sbt assembly, which I followed the link https://github.com/sbt/sbt-assembly : . When I run "sbt assembly", the jar file can be run

user1000652
  • 33
  • 2
  • 12