4
votes

I keep getting the error

Error while loading AnnotatedElement, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken

When running SBT against my project. It appears this error is due to this problem with Scala 2.10 not working with JDK 8. I do have scala 2.11 set and my SCALA_HOME points to Scala 2.11 at "SCALA_HOME=/Library/Scala/scala-2.11.2".

So any idea how to force SBT to use this version or check what version it is currently trying to use?

2
When do you see the issue? Is this at startup when the sbt launcher launches sbt or is this at calling a task? Can you briefly explain the moment where you hit the issue? I assume it's the former - at startup - and you can't change the Scala version sbt uses. Even if you managed to convince sbt to run with another Scala version, it may break plugins. Elaborate more on the moment of the error.Jacek Laskowski

2 Answers

2
votes

In your Build.sbt change the Scala version specified to the version you want (it defaults to what SBT was built with)

scalaVersion := "2.11.2"

http://www.scala-sbt.org/release/docs/Howto-Scala.html

1
votes

Add to the build.sbt this line:

scalaVersion := "2.11.2"