You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2022/06/06 03:14:16 UTC

[rocketmq] branch develop updated: [ISSUE #23] solve error Algorithm HmacSHA1 not available when your java_home is not found (#3869)

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

duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 96e8501d9 [ISSUE #23] solve error Algorithm HmacSHA1 not available when your java_home is not found (#3869)
96e8501d9 is described below

commit 96e8501d9e386e07bfa0c167ab1d3d156eaff0cb
Author: TianMing2018 <24...@qq.com>
AuthorDate: Mon Jun 6 11:14:04 2022 +0800

    [ISSUE #23] solve error Algorithm HmacSHA1 not available when your java_home is not found (#3869)
---
 distribution/bin/tools.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/distribution/bin/tools.sh b/distribution/bin/tools.sh
index d3fa7eb65..17207703a 100644
--- a/distribution/bin/tools.sh
+++ b/distribution/bin/tools.sh
@@ -24,6 +24,20 @@ error_exit ()
     exit 1
 }
 
+find_java_home()
+{
+    case "`uname`" in
+        Darwin)
+            JAVA_HOME=$(/usr/libexec/java_home)
+        ;;
+        *)
+            JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
+        ;;
+    esac
+}
+
+find_java_home
+
 [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
 [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
 [ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!"