Why do I get java.lang.NoClassDefFoundError when I trying to run this code?

后端 未结 2 1223
再見小時候
再見小時候 2021-02-19 05:50

I want to map over the characters in a string, but I\'m getting runtime errors.

Example:

object Hello {
    def hello(c: Char) {
        print(c)
    }

         


        
2条回答
  •  醉梦人生
    2021-02-19 06:50

    Also seeing this problem because I don't have the right version of Scala. For those who are using IntelliJ, you can add/change the scala SDK under File > Project Structures > Global Libraries:

    If you are compiling and running your project in command line, make sure you have the right version of Scala installed too. e.g.:

    Check the Scala version installed:

    $ scala -version
    Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL
    

    Check the build.sbt to have the right version of Scala:

    scalaVersion := "2.11.8"
    

提交回复
热议问题