You're viewing all posts tagged with sbt

java.lang.NoClassDefFoundError: scala/ScalaObject with sbt

Spent some time trying to figure out why sbt no longer worked for me when I upgraded the sbt-launch jar to the 0.11.0 version.  It would complain about a NoClassDefFoundError on scala/ScalaObject.  0.10.0 and earlier versions of sbt ran perfectly.  The problem wasn’t related to a project configuration file as this error occurred even if I ran sbt in a completely empty directory.

Since I’m knew to scala and sbt, I wasn’t sure what it was doing behind the scenes, so I didn’t know where to look.  I’m sure it’s documented somewhere but the troubleshooting link I found didn’t help. 

I knew sbt managed scala versions behind the scenes, so not finding ScalaObject meant that the download was perhaps corrupt.  So the solution was to figure out where sbt puts these things.  I knew it created a local boot folder for new projects I created, but it turns out sbt also keeps a global boot folder under your home folder in ~/.sbt/boot/ (which was C:/Users/<username>/.sbt on my Windows 7 machine). 

Deleting this global boot folder so sbt recreates it was the key.  If you get a similar error message for a specific project, the local boot folder would probably be the culprit in that case.