Search code examples
scalaplayframeworktypesafe-activator

UnsupportedClassVersionError on play with JDK 1.7


I am getting the same error as this post. i'm trying to resolve the problem as mentioned in the proposed solution but i didn't understand how ?


Solution

  • If you are using version 2.4.x (or newer), you must use Java 8. From the Highlights of version 2.4:

    Play 2.4 now requires JDK 8. Due to this, Play can, out of the box, provide support for Java 8 data types. For example, Play’s JSON APIs now support Java 8 temporal types including Instance, LocalDateTime and LocalDate.

    To confirm that you are using Play 2.4, see file project/plugins.sbt.

    Edit:

    If you can't (or don't want to) use Java 8, you have to use Play 2.3 instead. To do so, you must edit project/plugins.sbt to change the used version of Play:

    // Notice we are now using version 2.3.10
    addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.10")
    

    If this is a brand new project, you can recreate it using 2.3 template instead:

     activator new play-scala-2.3 name-of-your-project
    

    Or, for Java:

    activator new play-java-2.3 name-of-your-project