From 935a44313477fc135a3cfba7319cea84e7e65b2f Mon Sep 17 00:00:00 2001 From: lkun <646703306@qq.com> Date: Mon, 23 Dec 2024 20:26:53 +0800 Subject: [PATCH] optimize: support resolving JAVA_HOME from symbolic links when `which java` is used --- distribution/bin/startup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/distribution/bin/startup.sh b/distribution/bin/startup.sh index cfe2f486126..60a32593221 100644 --- a/distribution/bin/startup.sh +++ b/distribution/bin/startup.sh @@ -51,6 +51,9 @@ if [ -z "$JAVA_HOME" ]; then if [ -z "$JAVA_PATH" ]; then error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!" fi + if [ -L "$JAVA_PATH" ]; then + JAVA_PATH=$(readlink -f "$JAVA_PATH") + fi JAVA_HOME=$(dirname "$JAVA_PATH")/.. export JAVA_HOME=$(cd "$JAVA_HOME" && pwd) fi