Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK 8 support at DIY cartridge in OpenShift

I know WildFly cartridge doesn't have JDK support, but can I somehow install Java 8 at experimental DIY cartridge? java-1.7.0 is the latest version available at /usr/lib .

like image 895
juanignaciosl Avatar asked May 27 '14 16:05

juanignaciosl


2 Answers

If you want an specific JDK version you can download it and set the environment variables:

cd $OPENSHIFT_DATA_DIR
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
tar -zxf jdk-8u5-linux-x64.tar.gz
export PATH=$OPENSHIFT_DATA_DIR/jdk1.8.0_05/bin:$PATH
export JAVA_HOME="$OPENSHIFT_DATA_DIR/jdk/jdk1.8.0_05"

Thanks to this cartridge.

As @youssef points out, you should also add this lines to .openshift/action_hooks/start:

export JAVA_HOME="$OPENSHIFT_DATA_DIR/jdk/jdk1.8.0_05"
export PATH=$OPENSHIFT_DATA_DIR/jdk1.8.0_05/bin:$PATH

UPDATE: now OpenShift has added alternative runtimes, you can skip downloading your own:

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH
like image 120
juanignaciosl Avatar answered Oct 18 '22 17:10

juanignaciosl


Java 8 is now available by default with DIY. You just need to set PATH as given below in your /.openshift/action_hooks/start.sh

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH
like image 32
Sathish Kumar Thiyagarajan Avatar answered Oct 18 '22 15:10

Sathish Kumar Thiyagarajan