0

I'm trying to deploy a Play2 application on Openshift. I'm using the build from scratch feature with the following base: http://cartreflect-claytondev.rhcloud.com/reflect?github=tyrcho/openshift-cartridge-play2

my project want to use java8, which is already installed on:

/etc/alternatives/java_sdk_1.8.0/bin/javac -version
javac 1.8.0_31

/etc/alternatives/java_sdk_1.8.0/bin/java -version
openjdk version "1.8.0_31"
OpenJDK Runtime Environment (build 1.8.0_31-b13)
OpenJDK Server VM (build 25.31-b07, mixed mode)

I tried to set JAVA_HOME with the following techniques:

  • set JAVA_HOME environment variables with RHC:

rhc set-env JAVA_HOME=/etc/alternatives/java_sdk_1.8.0/bin -a insightserver
Setting environment variable(s) ... done

  • set JAVA_HOME environment by action_hooks in pre-built:

export PATH=/etc/alternatives/java_sdk_1.8.0/bin:$PATH
export JAVA_HOME="/etc/alternatives/java_sdk_1.8.0"

  • I even tried to download Java new, and use the local installation:

JDK 8 support at DIY cartridge in OpenShift

  • I tried to set markers in openshift to set java8:

rhc ssh: touch .openshift/markers/java8

But still:

readlink -f $(which java)
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75/jre/bin/java

Now I don't have any ideas anymore. does somebody know how to switch to java8 ?

Community
  • 1
  • 1
Christof Buechi
  • 163
  • 1
  • 12

1 Answers1

0

This might help? https://github.com/thomson256/play-diy-scripts I have done Play in Openshift with DIY approach, not custom cartridge. So you need the action hook scripts only.

With Play 2.3 the path in action_hooks/start needs to be target/universal/start (line 18), what is the Play's stage folder structre.

Sidenote: i have only hobbyist sites running so far in Openshift, but even them i upgraded as Bronze plan (still free) as with free tier they idle crashed like once per month because little/no use.

Thomson256
  • 217
  • 3
  • 7
  • Actually i didnt answer to your main question, stupid me :) so to do so i updated my play-diy-scripts with [Java 8 answer](https://github.com/thomson256/play-diy-scripts#java-8-update) – Thomson256 Apr 08 '15 at 02:06
  • thank you for all your work. I dont know why, but I stuck by setting JAVA_HOME and the PATH: (it is accepted - the path is valid, but it uses still java 1.7.) – Christof Buechi Apr 13 '15 at 20:49
  • I think the key is using Openshift env variable ``${OPENSHIFT_DATA_DIR}`` when installing JDK and putting it on PATH: [action_hook/start](https://github.com/thomson256/play-diy-scripts/blob/master/copy-these/.openshift/action_hooks/start). My running app [here](http://playshifted-thomson256.rhcloud.com/) – Thomson256 Apr 14 '15 at 13:58
  • Why not just use the already installed jdk ? Is there a problem with that ? (/etc/alternatives/java_sdk_1.8.0) – Christof Buechi Apr 23 '15 at 06:46