You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by zh...@apache.org on 2022/12/26 11:24:43 UTC

[rocketmq-connect] branch master updated: [ISSUE #333] add find_java_home function to runconnect.sh (#334)

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

zhoubo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-connect.git


The following commit(s) were added to refs/heads/master by this push:
     new 4477284f [ISSUE #333] add find_java_home function to runconnect.sh (#334)
4477284f is described below

commit 4477284f3885cf9192f8334ddb894ee5b71ed941
Author: Slideee <ye...@corp.netease.com>
AuthorDate: Mon Dec 26 19:24:38 2022 +0800

    [ISSUE #333] add find_java_home function to runconnect.sh (#334)
---
 distribution/bin/runconnect.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/distribution/bin/runconnect.sh b/distribution/bin/runconnect.sh
index 273258e7..0c9c5d0d 100644
--- a/distribution/bin/runconnect.sh
+++ b/distribution/bin/runconnect.sh
@@ -45,6 +45,19 @@ check_java_version ()
   echo $flag
 }
 
+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