From dd9fe84bc86ef8574d400c019c7b1a444c7f7a4b Mon Sep 17 00:00:00 2001 From: Andrey Shitov Date: Thu, 17 Oct 2024 13:37:49 +0300 Subject: [PATCH] Fix: Use JAVA_HOME to get the correct Java version in environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Replaced direct java -version command with ${JAVA_HOME}/bin/java -version to ensure the Java version is fetched from the correct Java installation specified by JAVA_HOME. This improves compatibility and prevents potential issues when multiple Java versions are installed on the system. --- hadoop-ozone/dist/src/shell/ozone/ozone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/dist/src/shell/ozone/ozone b/hadoop-ozone/dist/src/shell/ozone/ozone index ae088445847..41c72b2e26c 100755 --- a/hadoop-ozone/dist/src/shell/ozone/ozone +++ b/hadoop-ozone/dist/src/shell/ozone/ozone @@ -84,7 +84,7 @@ function ozonecmd_case OZONE_MODULE_ACCESS_ARGS="" # Get the version string - JAVA_VERSION_STRING=$(java -version 2>&1 | head -n 1) + JAVA_VERSION_STRING=$(${JAVA_HOME}/bin/java -version 2>&1 | head -n 1) # Extract the major version number JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION_STRING" | sed -E -n 's/.* version "([^.-]*).*"/\1/p' | cut -d' ' -f1)