1
我試圖在Play上使用play-scalr,並按照Github page上的安裝說明進行操作,但是當我請求調整大小的圖像時,出現錯誤:使用play-scalr引發不支持的major.minor版本51.0
[RuntimeException: java.lang.UnsupportedClassVersionError: se/digiplant/scalr/api/Resizer$Mode : Unsupported major.minor version 51.0]
當我編譯了該項目,瓶被下載,所以我認爲這個問題是,他們使用Java 1.7編譯,但是我試圖用Java 1.6的使用:
$ play compile
[info] Loading project definition from /Users/brad/projects/builders/project
[info] Set current project to builders (in build file:/Users/brad/projects/builders/)
[info] Updating {file:/Users/brad/projects/builders/}builders...
[info] downloading http://repo1.maven.org/maven2/se/digiplant/play-scalr_2.10/1.0/play-scalr_2.10-1.0.jar ...
[info] [SUCCESSFUL ] se.digiplant#play-scalr_2.10;1.0!play-scalr_2.10.jar (2782ms)
[info] downloading http://repo1.maven.org/maven2/se/digiplant/play-res_2.10/1.0/play-res_2.10-1.0.jar ...
[info] [SUCCESSFUL ] se.digiplant#play-res_2.10;1.0!play-res_2.10.jar (2553ms)
[info] Done updating.
[success] Total time: 26 s, completed 14/04/2013 3:06:18 PM
以下是我使用的版本:
$ play about
[info] Loading project definition from /Users/brad/projects/builders/project
[info] Set current project to builders (in build file:/Users/brad/projects/builders/)
[info] This is sbt 0.12.2
[info] The current project is {file:/Users/brad/projects/builders/}builders
[info] The current project is built against Scala 2.10.0
[info] Available Plugins: play.Project, sbt.PlayProject, com.typesafe.sbteclipse.plugin.EclipsePlugin, com.typesafe.sbtidea.SbtIdeaPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
$ scala -version
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)
$ javac -version
javac 1.6.0_43
你說得對。 Java 7編譯器對主要版本爲51的類進行「標記」,但Java 6需要版本50.您需要使用Java 6進行編譯或使用Java 7進行運行。 – dcernahoschi
@dcernahoschi感謝您的確認:) –