Play Framework 2.2.2 with JDK 1.7.0_79 启动问题

Play Framework 2.2.2 with JDK 1.7.0_79 Starting issue

我正在使用 Fedora、Play 2.2.2 和 JDK 1.7.0_79

我已经创建了新项目 HelloWorld,当我尝试 运行 它时,得到了 以下错误

[HelloWorld] $ run

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

[info] play - Application started (Dev) [error] application -

! Internal server error, for (GET) [/] ->

java.lang.UnsupportedClassVersionError: controllers/Application : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_79] at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_79] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_79] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_79] at java.net.URLClassLoader.access0(URLClassLoader.java:71) ~[na:1.7.0_79] at java.net.URLClassLoader.run(URLClassLoader.java:361) ~[na:1.7.0_79] [error] application - Error while rendering default error page scala.MatchError: java.lang.UnsupportedClassVersionError: controllers/Application : Unsupported major.minor version 52.0 (of class java.lang.UnsupportedClassVersionError) at play.api.GlobalSettings$class.onError(GlobalSettings.scala:131) ~[play_2.10.jar:2.2.2] at play.api.DefaultGlobal$.onError(GlobalSettings.scala:189) [play_2.10.jar:2.2.2] at play.core.server.Server$class.logExceptionAndGetResult(Server.scala:73) [play_2.10.jar:2.2.2] at play.core.server.Server$$anonfun$getHandlerFor.apply(Server.scala:83) [play_2.10.jar:2.2.2] at play.core.server.Server$$anonfun$getHandlerFor.apply(Server.scala:81) [play_2.10.jar:2.2.2] at scala.util.Either$RightProjection.flatMap(Either.scala:523) [scala-library.jar:na]

我是新手,不知道...按照 pdf 教程下载了相同版本的 play 2.2.2

很难准确地说,但这通常是因为您 run 使用 jdk 1.7 并使用 jdk 1.8 编译。您可以尝试将以下内容添加到您的 build.sbt:

javacOptions ++= Seq("-source", "1.7", "-target", "1.7")

你肯定只安装了jdk 1.7