Wednesday, September 17, 2014

Scala issue... with Java 8 - class file is broken

Trying to run an sbt command in a freshly installed Scala environment I've got the following error:


error: error while loading CharSequence, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
view raw gistfile1.txt hosted with ❤ by GitHub
Turns out it was an incompatibility error due to my Java 8 environment:
http://stackoverflow.com/questions/24197836/compilation-failed-error-while-loading-annotatedelement-concurrentmap-charseq

These instructions promptly pointed me how to select the active java jdk for a bash session:
http://superuser.com/questions/490425/how-do-i-switch-between-java-7-and-java-6-on-os-x-10-8-2

Changed it to 1.7 and it all runs well now.