如何设置Play Framework 2.0的javac编译版本,以防止出现"Unsupported major.minor version"? [英] How can I set the javac compile version for Play Framework 2.0 to prevent "Unsupported major.minor version"?
问题描述
我正在使用的模块必须已经用Java 1.7编译,而我只有1.6.
A module I am using must have been compiled with Java 1.7, and I only have 1.6.
如果要针对特定版本(例如1.6)编译模块,如何在Play中进行设置! Framework 2.0,这样我就可以防止出现"Unsupported major.minor version"错误.
If I want to for the module to be compiled for a specific version like 1.6, how can I set that in Play! Framework 2.0 so that I can prevent the "Unsupported major.minor version" errors.
正在播放! 1.x,您可以在application.conf中设置"java.version = 1.6".
In Play! 1.x you could set "java.version=1.6" in the application.conf.
我认为这是在Play中! 2.x可能需要在某处设置sbt-但是在哪里/如何?
I assume that in Play! 2.x it probably needs to be set somewhere for sbt - but where/how?
推荐答案
添加
javacOptions ++= Seq("-source", "1.6", "-target", "1.6")
build.sbt 文件对我有用(透明,在我的情况下,使用JDK 8进行构建是1.7).
to the build.sbt file worked for me (to be transparent, in my case it was 1.7 to build with JDK 8).
这篇关于如何设置Play Framework 2.0的javac编译版本,以防止出现"Unsupported major.minor version"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!