Java version validation failed and fail to find java command in PATH
search cancel

Java version validation failed and fail to find java command in PATH

book

Article ID: 296038

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

Symptoms:

When attempting to install the GPText binary it fails with an error message explaining that the process failed to find the java command in the PATH environment variable.

This can be seen in environments where a non-oracle Java JRE is in the PATH environment variable.

[CRITICAL]:-Installation failed: Java version validation failed on xxxx.xxxx. Failed to find java command in PATH

Environment


Cause

In versions  of Pivotal GPText lower than v2.1.1, this issue occurs for two different reasons:
 

1. There is no java binary in the PATH environment variable.

[gpadmin@gpdb ~]$ java -version
-bash: java: command not found

2. There is an OpenJDK Java version in the PATH environment variable. GPText requires Oracle JDK 1.8.x.

[gpadmin@gpdb ~]$ java -version
openjdk version "1.8.0_45"
OpenJDK Runtime Environment (build 1.8.0_45-b13)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)

Note: In the 2.1.1 version, a new parameter called GPTEXT_JAVA_HOME has been introduced that gives the possibility to have a different java version set up in the PATH environment variable. 

Resolution

Install the Oracle JDK 1.8.x and include in the PATH environment variable.

The following script can be used to install Oracle JDK 1.8.0_1.3.1 and include Oracle JDK 1.8.0_1.3.1 it in the path: 

cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
tar xzf jdk-8u131-linux-x64.tar.gz
rm -rf /opt/jdk-8u131-linux-x64.tar.gz

cd /opt/jdk1.8.0_131/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_131/bin/java 2

eval java -version

export JAVA_HOME=/opt/jdk1.8.0_131
export JRE_HOME=/opt/jdk1.8.0_131/jre
export PATH=$PATH:/opt/jdk1.8.0_131/bin:/opt/jdk1.8.0_131/jre/bin >>>> .bashrc