0

I am using jdk 1.8 for development in java using play framework. However I need to build for 1.7 target. I already tried using

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

in build.sbt as given in this answer.

Community
  • 1
  • 1
gpothan
  • 151
  • 7
  • In what way is specifying the target version using compiler flags not working? – moem Nov 25 '15 at 09:32
  • I don't think it is working: http://stackoverflow.com/questions/16143684/can-java-8-code-be-compiled-to-run-on-java-7-jvm. – Kris Nov 25 '15 at 09:33
  • @Kris No it should work. In the link you provide, the author tries to compile Java 8 code to comply with Java 7 (i.e, source 1.8, target 1.7), which cannot work. In the current question, the OP is compiling Java 7 code to comply with Java 7. – moem Nov 25 '15 at 09:36

1 Answers1

0

Thank you all. I think I got it figured out. Strange behavior - its working after I moved the javacOptions line to the beginning. Previously it was in the end! This is the working build.sbt settings now.

name := "TestService"

version := "1.0-SNAPSHOT"

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

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  "org.hibernate" % "hibernate-entitymanager" % "4.3.8.Final"
)     

play.Project.playJavaSettings
gpothan
  • 151
  • 7