-
Notifications
You must be signed in to change notification settings - Fork 601
fix: upgrade required Java version in start scripts #2846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,15 @@ fi | |
|
|
||
| # check jdk version | ||
| JAVA_VERSION=$($JAVA -version 2>&1 | awk 'NR==1{gsub(/"/,""); print $3}' | awk -F'_' '{print $1}') | ||
| if [[ $? -ne 0 || $JAVA_VERSION < $EXPECT_JDK_VERSION ]]; then | ||
|
|
||
| if [[ $JAVA_VERSION == 1.* ]]; then | ||
| MAJOR_VERSION=$(echo $JAVA_VERSION | cut -d'.' -f2) | ||
| else | ||
| MAJOR_VERSION=$(echo $JAVA_VERSION | cut -d'.' -f1) | ||
| fi | ||
|
|
||
|
|
||
| if [[ $? -ne 0 || $MAJOR_VERSION -lt $EXPECT_JDK_VERSION ]]; then | ||
| echo "Please make sure that the JDK is installed and the version >= $EXPECT_JDK_VERSION" >> ${OUTPUT} | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+91
to
94
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicate logic? |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ function abs_path() { | |
| cd -P "$(dirname "$SOURCE")" && pwd | ||
| } | ||
|
|
||
| REQUIRED_JAVA_VERSION="11" | ||
| BIN=$(abs_path) | ||
| TOP="$(cd "${BIN}"/../ && pwd)" | ||
| CONF="$TOP/conf" | ||
|
|
@@ -47,9 +48,20 @@ 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" | ||
|
|
||
| # Extract the major version number for numerical comparison | ||
| if [[ $JAVA_VERSION == 1.* ]]; then | ||
| MAJOR_VERSION=$(echo $JAVA_VERSION | cut -d'.' -f2) | ||
| else | ||
| MAJOR_VERSION=$(echo $JAVA_VERSION | cut -d'.' -f1) | ||
| fi | ||
|
|
||
| # Compare with the required Java version | ||
| if [[ $? -eq 0 && $MAJOR_VERSION -ge $REQUIRED_JAVA_VERSION ]]; then | ||
| DEFAULT_JAVA_OPTIONS="--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED" | ||
|
Comment on lines
+52
to
+61
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里的逻辑需要更新了, 现在是必须要求 Java 版本 == 11, 而不只是 Java9 之后了 所以麻烦修改一下这里的逻辑, 如果不符合请直接清晰的告诉用户需要使用 Java xx (这个抽取为一个变量, 方便后续升级 Java17/21 的时候直接调整即可, 避免硬编码了) 另外同时也看看 pd/store 的启动脚本里是否有版本检查, 一并可以同步一下, THX
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 好的 |
||
| else | ||
| echo "Error: This application requires Java version $REQUIRED_JAVA_VERSION or higher." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Initializing HugeGraph Store..." | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic need to refactor like
And test it
