I follow the tutorial of sbt Hello World, and I mkdir with hw.scala and build.sbt in it.
then I type sbt run
and execute it, then occur a error
java.lang.NoClassDefFoundError: scala/Function1
But if I change the scalaVersion
in build.sbt, for example, I change it to 2.11.7
and it will be successful output "Hi" with the example code.
How to solve this error? Thanks everyone helping me.
the error:
- [info] 'compiler-interface' not yet compiled for Scala 2.11.8. Compiling...
- [info] Resolving org.scala-sbt#interface;0.13.13 ...
- [trace] Stack trace suppressed: run last compile:compileIncremental for the full output.
- [error] (compile:compileIncremental) java.lang.NoClassDefFoundError: scala/Function1
and my code build.sbt
, hw.scala
:
lazy val root = (project in file(".")).
settings(
name := "hello",
version := "0.1.0",
scalaVersion := "2.11.8"
)
-
object Hi { def main(args: Array[String]) = println("Hi!") }