fix: upgrade required Java version in start scripts#2846
Open
hexuxu110 wants to merge 4 commits intoapache:masterfrom
Open
fix: upgrade required Java version in start scripts#2846hexuxu110 wants to merge 4 commits intoapache:masterfrom
hexuxu110 wants to merge 4 commits intoapache:masterfrom
Conversation
VGalaxies
reviewed
Jul 31, 2025
| if [[ $? -eq 0 && $JAVA_VERSION > "1.9" ]]; then | ||
| DEFAULT_JAVA_OPTIONS="--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED" | ||
|
|
||
| # 提取主版本号进行数值比较 |
Contributor
There was a problem hiding this comment.
please translate them into English~
imbajin
reviewed
Aug 1, 2025
Comment on lines
52
to
59
| 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" |
Member
There was a problem hiding this comment.
这里的逻辑需要更新了, 现在是必须要求 Java 版本 == 11, 而不只是 Java9 之后了
所以麻烦修改一下这里的逻辑, 如果不符合请直接清晰的告诉用户需要使用 Java xx (这个抽取为一个变量, 方便后续升级 Java17/21 的时候直接调整即可, 避免硬编码了)
另外同时也看看 pd/store 的启动脚本里是否有版本检查, 一并可以同步一下, THX
imbajin
reviewed
Aug 5, 2025
Comment on lines
81
to
92
| 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 |
Member
There was a problem hiding this comment.
The logic need to refactor like
#!/bin/bash
# Expected JDK version
EXPECT_JDK_VERSION=11
# Extract and check Java version
JAVA_VERSION=$(java -version 2>&1 | head -n1 | sed -n 's/.*version "\([0-9]*\)\..*/\1/p')
if [[ "$JAVA_VERSION" != "$EXPECT_JDK_VERSION" ]]; then
echo "Expected Java ${EXPECT_JDK_VERSION}, but found Java ${JAVA_VERSION} ✗" >> ${OUTPUT}
fi
imbajin
reviewed
Aug 11, 2025
Comment on lines
+91
to
94
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

fix the bug in JDK version comparison