You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2023/03/13 09:47:20 UTC

[ratis] branch master updated: RATIS-1813. Allow ratis-shell to run in JDK 8+ (#851)

This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new bde35c666 RATIS-1813. Allow ratis-shell to run in JDK 8+ (#851)
bde35c666 is described below

commit bde35c6662489a6198fa7960bed767f152e4d180
Author: Kaijie Chen <ck...@apache.org>
AuthorDate: Mon Mar 13 17:47:14 2023 +0800

    RATIS-1813. Allow ratis-shell to run in JDK 8+ (#851)
---
 ratis-shell/src/main/libexec/ratis-shell-config.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ratis-shell/src/main/libexec/ratis-shell-config.sh b/ratis-shell/src/main/libexec/ratis-shell-config.sh
index 27d2ee0a1..71fda692b 100644
--- a/ratis-shell/src/main/libexec/ratis-shell-config.sh
+++ b/ratis-shell/src/main/libexec/ratis-shell-config.sh
@@ -50,12 +50,12 @@ if [[ -z "${JAVA}" ]]; then
   fi
 fi
 
-# Check Java version == 1.8 or == 11
+# Check Java version == 1.8 or >= 8
 JAVA_VERSION=$(${JAVA} -version 2>&1 | awk -F '"' '/version/ {print $2}')
-JAVA_MAJORMINOR=$(echo "${JAVA_VERSION}" | awk -F. '{printf("%03d%03d",$1,$2);}')
-JAVA_MAJOR=$(echo "${JAVA_VERSION}" | awk -F. '{printf("%03d",$1);}')
-if [[ ${JAVA_MAJORMINOR} != 001008 && ${JAVA_MAJOR} != 011 ]]; then
-  echo "Error: ratis-shell requires Java 8 or Java 11, currently Java $JAVA_VERSION found."
+JAVA_MAJORMINOR=$(echo "${JAVA_VERSION}" | awk -F. '{printf "%d.%d",$1,$2}')
+JAVA_MAJOR=$(echo "${JAVA_VERSION}" | awk -F. '{print $1}')
+if [[ ${JAVA_MAJORMINOR} != 1.8 && ${JAVA_MAJOR} -lt 8 ]]; then
+  echo "Error: ratis-shell requires Java 8+, currently Java $JAVA_VERSION found."
   exit 1
 fi