I developed a Play application using Java 1.7. Now I need to compile it against version 1.6 because it will be executed on another host that still uses 1.6 (and I cannot change that)
So I copied the startup script play to play-1.6 and changed it in a way so that it uses JDK version 1.6 (which I have stored in a directory on my computer)
When executing this modified script in any directory I get the desired info line
play! 2.1.0 (using Java 1.6.0_38 and Scala 2.10.0), http://www.playframework.org
When I execute the same script in my project directory I get the line
play! 2.1.0 (using Java 1.7.0_09 and Scala 2.10.0), http://www.playframework.org
Where is this information stored that the project uses version 1.7 and how can I force it to compile against 1.6?
Update 1
Maxime Calmels proposed to perform a clean in order to eventually remove compiled configuration files. Unfortunately this didn't help.
Update 2
When I typed java-home in the play console, I got the message
[info] None
So I created a file build.sbt and added the content
javaHome := Some(file("/usr/java/jdk1.6.0_38"))
When starting up the play console and type java-home now I get the line
[info] Some(/usr/java/jdk1.6.0_38)
But play still compiles against version 1.7, so no luck with that either.
Update 3
I got it working... BUT only by copying Play and my project to the host where the project should be run and compiled it there. Not a very elegant solution and I still wonder how I could do it locally on my machine.
Wherever you installed Play, you should be able to change the "play" script by replacing this like with:
if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/bin/java"
fi
this new line:
JAVA="/TheFullJavaPath/bin/java"
That should do it. Then that script would use that version. I recommend naming it like you have to play-java-1.X or something.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With