Rob
Rob

Reputation: 718

openshift set env jdk8

I have 2 Cartridges on openshift platform

I have also precompiled war file i want to deploy in the weapps/ directory in my openshift git repository (pushed into remote server).

Problem is war file is compiled to run in 1.8jre and the default jre is 1.7

I created simple executable shell script named start in repo in directory

.openshift/action_hooks/

#!/bin/bash

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

But still after restart app rhc app-restart myApp system variable JAVA_HOME is set back to jdk7.

Could you please point me out where is the problem?

Upvotes: 0

Views: 624

Answers (1)

aug70co
aug70co

Reputation: 3987

The script you are using is correct and must work. In the action_hooks/start script, add below lines.

#!/bin/bash
export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH
echo $(java -version)
echo 'Starting application...'

You must see java 8. Anytime you start your application it should be same.

Upvotes: 0

Related Questions