imbajin commented on code in PR #2846:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2846#discussion_r2265786499


##########
hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh:
##########
@@ -78,8 +78,17 @@ else
 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
+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
+
+
+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

Review Comment:
   duplicate logic?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to