Scala compiler error on a corrupted JAR

Just today I was battling with a bug which only manifested itself with an error "Failed to initialize compiler: object scala.runtime in compiler mirror not found." There is no explanation to the bug, but at least there is a (funny) discussion: SI-7882.

In short, scala compiler tried to load referenced JARs, some of them were corrupted and compiler just dies. Thanks to Jason Zaugg you have a better error if you are using 2.11.0-M5 version of Scala. Even if you don't, it makes sense to switch to it just to see the error message. It will tell you which JAR file is corrupted.

Of course there is another quick solution. You may want to delete your JAR storage (~/.m2 in case of Maven) to get rid of whatever corrupted JAR file you had.