You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "hexuxu110 (via GitHub)" <gi...@apache.org> on 2025/08/04 14:49:49 UTC
Re: [PR] fix: upgrade required Java version in start scripts [incubator-hugegraph]
hexuxu110 commented on code in PR #2846:
URL: https://github.com/apache/incubator-hugegraph/pull/2846#discussion_r2251739905
##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/init-store.sh:
##########
@@ -47,9 +47,16 @@ cd "${TOP}" || exit
DEFAULT_JAVA_OPTIONS=""
JAVA_VERSION=$($JAVA -version 2>&1 | awk 'NR==1{gsub(/"/,""); print $3}' | awk -F'_' '{print $1}')
-# TODO: better not string number compare, use `bc` like github.com/koalaman/shellcheck/wiki/SC2072
-if [[ $? -eq 0 && $JAVA_VERSION > "1.9" ]]; then
- DEFAULT_JAVA_OPTIONS="--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED"
+
+# 提取主版本号进行数值比较
+if [[ $JAVA_VERSION == 1.* ]]; then
+ MAJOR_VERSION=$(echo $JAVA_VERSION | cut -d'.' -f2)
+else
+ MAJOR_VERSION=$(echo $JAVA_VERSION | cut -d'.' -f1)
+fi
+
+if [[ $? -eq 0 && $MAJOR_VERSION -ge 9 ]]; then
+ DEFAULT_JAVA_OPTIONS="--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED"
Review Comment:
好的
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org