The default version of openjdk installed is openjdk-8 which
is set through the Jenkins job.
For CentOS we are installing jdk-11 and jdk-10 under /opt. So
we need to check the version of openjdk for the job to pick up
the right version of JDK.
Issue: RELENG-1454
Change-Id: I19d77c509c90bca5fea1af53dacc35772c7ac939
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
JAVA_ENV_FILE="/tmp/java.env"
update-java-redhat() {
- export JAVA_HOME="/usr/lib/jvm/java-1.${SET_JDK_VERSION: -1}.0-openjdk"
+ if [[ "${SET_JDK_VERSION: -2}" = "11" ]]; then
+ export JAVA_HOME="/opt/jdk-11"
+ elif [[ "${SET_JDK_VERSION: -2}" = "10" ]]; then
+ export JAVA_HOME="/opt/jdk-10.0.2"
+ else
+ export JAVA_HOME="/usr/lib/jvm/java-1.${SET_JDK_VERSION: -1}.0-openjdk"
+ fi
sudo /usr/sbin/alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 1
sudo /usr/sbin/alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 1
sudo /usr/sbin/alternatives --install /usr/lib/jvm/java-openjdk java_sdk_openjdk "${JAVA_HOME}" 1