Casey Murray
Casey Murray

Reputation: 1582

Using Play Framework 2.4+ on a server with Java 7 in the path

I was successful in migrating a Play 2.1 application to 2.4 on my development machine (with Java 8 on the classpath) but I now need to transfer it to a server that only has a java version "1.7.0_65".

Is it possible to include java 8 in the form of the Java 8 jar in the lib/ folder of the Play application as an unmanaged dependency when putting it on the server? Do I need to tell Play to use this instead of what is on the classpath of the server or will it check lib/ first? I'm new to Play and have lots to learn - sorry if this is an easy solution I've missed and thanks in advance for the help!

Upvotes: 0

Views: 90

Answers (1)

Kris
Kris

Reputation: 4823

You need to have Java 8 on the server to run Play 2.4. Whether this is already installed on the server or it comes with your application isn't important. You can even have several different Java installations on your server and use them in parallel.

The easiest solution would be to update Java 7 on the server to Java 8. Java 8 is (should be) backwards compatible and all application running with Java 7 should run with Java 8 too.

If an Java update isn't an option you could also bundle Java 8 together with your distribution. I'm doing this for a project where I conveniently offer Java bundled with the application so the users don't have to download it extra.

To bundle I build a distribution with activator dist, then unzip and manually put an Java 8 JRE into an extra folder next to /lib, /conf and /bin. I wouldn't put it into the lib folder, since it isn't really a library. Before you start your application you need to set the JAVA_HOME, e.g. with export JAVA_HOME="/path-to-my-application/jre-java-8-folder". Then start like always with /path-to-my-application/bin/foo.sh. Done.

Upvotes: 3

Related Questions