1
  1. I am using OpenJDK 11 with SBT 1.5.4

  2. I have also set my System Environment Variable path to C:\sbt\bin - i.e. I am on Windows

  3. I also have JAVA_HOME defined.

When I run sbt command from command line, I am getting the following error:

copying runtime jar...
[info] [launcher] getting org.scala-sbt sbt 1.4.1  (this may take some time)...
[info] [launcher] getting Scala 2.13.3 (for sbt)...
java.lang.NoClassDefFoundError: scala/Serializable
        at sbt.internal.ClassLoaderWarmup$.warmup(XMainConfiguration.scala:31)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at sbt.internal.XMainConfiguration.run(XMainConfiguration.scala:82)
        at sbt.xMain.run(Main.scala:46)
        at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
        at xsbt.boot.Launch$.run(Launch.scala:149)
        at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
        at xsbt.boot.Launch$.launch(Launch.scala:159)
        at xsbt.boot.Launch$.apply(Launch.scala:44)
        at xsbt.boot.Launch$.apply(Launch.scala:21)
        at xsbt.boot.Boot$.runImpl(Boot.scala:78)
        at xsbt.boot.Boot$.run(Boot.scala:73)
        at xsbt.boot.Boot$.main(Boot.scala:21)
        at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.ClassNotFoundException: scala.Serializable
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 18 more
[error] [launcher] error during sbt launcher: java.lang.NoClassDefFoundError: scala/Serializable

I don't know what I am doing wrong because as per documentation, this should just work. I also tried deleting HOME/.sbt directory to repeat the process, but no luck. Any idea from anyone?

1 Answer 1

2

It says [info] [launcher] getting Scala 2.13.3 (for sbt).... But sbt should always use Scala 2.12. Do you have a line like scalaVersion := "2.13.3" somewhere in the project directory?

Sign up to request clarification or add additional context in comments.

2 Comments

no in my build.sbt I have scalaVersion defined as 2.11.6. That'
The Scala version used for your build isn't specified in build.sbt but in a .sbt file in your project directory. This is why I specifically asked about the project directory.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.