Exception in running your first HelloWorld program in scala

 object HelloWorld {
    def main(args: Array[String]) {
      println("Hello, world!")
    }
  }

Error message may looks like this

Exception in thread “main” java.lang.UnsupportedClassVersionError: scala/tools/nsc/MainGenericRunner : Unsupported major.minor version 52.0


This took me for a while to figure out, but got it quickly, it’ because of difference in JVM version and Scala version.

Solution

  • For Scala version scala-2.12.1 you need to use Java 1.8
  • For Scala version 2.10.6, use java version 1.6+ (1.7 also works)

 

Woow, Scala is rocking !!!

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *