This is an automated email from the ASF dual-hosted git repository.

jiangtian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b6aa45b18b fix start.cli on java 8 (#17228)
3b6aa45b18b is described below

commit 3b6aa45b18b3e26f1fd51a7b956060eb6f848336
Author: Hongzhi Gao <[email protected]>
AuthorDate: Sat Feb 28 12:40:07 2026 +0800

    fix start.cli on java 8 (#17228)
    
    * fix start.cli on java 8
    
    * fix maven badge
---
 README.md                          |  2 +-
 README_ZH.md                       |  2 +-
 scripts/sbin/windows/start-cli.bat | 18 ++++++++++++++++--
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 0e93c9b7ede..cf70bca161d 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@
 
![](https://img.shields.io/badge/platform-win%20%7C%20macos%20%7C%20linux-yellow.svg)
 ![](https://img.shields.io/badge/java--language-1.8+-blue.svg)
 [![IoTDB 
Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/)
-[![Maven 
Version](https://maven-badges.herokuapp.com/maven-central/org.apache.iotdb/iotdb-parent/badge.svg)](http://search.maven.org/#search|gav|1|g:"org.apache.iotdb")
+[![Maven 
Central](https://img.shields.io/maven-central/v/org.apache.iotdb/iotdb-parent.svg)](https://central.sonatype.com/artifact/org.apache.iotdb/iotdb-parent)
 [![Gitpod 
Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/apache/iotdb)
 [![Slack 
Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://join.slack.com/t/apacheiotdb/shared_invite/zt-qvso1nj8-7715TpySZtZqmyG5qXQwpg)
 
diff --git a/README_ZH.md b/README_ZH.md
index f53160db90d..870f990e332 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -31,7 +31,7 @@
 ![](https://img.shields.io/badge/java--language-1.8+-blue.svg)
 [![Language grade: 
Java](https://img.shields.io/lgtm/grade/java/g/apache/iotdb.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/apache/iotdb/context:java)
 [![IoTDB 
Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/)
-[![Maven 
Version](https://maven-badges.herokuapp.com/maven-central/org.apache.iotdb/iotdb-parent/badge.svg)](http://search.maven.org/#search|gav|1|g:"org.apache.iotdb")
+[![Maven 
Central](https://img.shields.io/maven-central/v/org.apache.iotdb/iotdb-parent.svg)](https://central.sonatype.com/artifact/org.apache.iotdb/iotdb-parent)
 [![Slack 
Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://join.slack.com/t/apacheiotdb/shared_invite/zt-qvso1nj8-7715TpySZtZqmyG5qXQwpg)
 
 # 简介
diff --git a/scripts/sbin/windows/start-cli.bat 
b/scripts/sbin/windows/start-cli.bat
index aa22808ed39..d3d85632533 100644
--- a/scripts/sbin/windows/start-cli.bat
+++ b/scripts/sbin/windows/start-cli.bat
@@ -115,9 +115,23 @@ if defined JAVA_HOME (
     set "JAVA=java"
 )
 
-REM JVM options
+REM Detect Java major version (--add-opens only for Java 9+, see JEP 396)
+set "JAVA_MAJOR="
+set "TEMP_VER=%TEMP%\iotdb_cli_java_ver.txt"
+"%JAVA%" -version 2>&1 | findstr /i "version" > "%TEMP_VER%"
+for /f "tokens=3" %%a in ('type "%TEMP_VER%"') do for /f "tokens=1,2 delims=." 
%%x in ("%%~a") do (
+    if "%%x"=="1" (set "JAVA_MAJOR=%%y") else (set "JAVA_MAJOR=%%x")
+    goto :jvm_opts
+)
+
+:jvm_opts
+del "%TEMP_VER%" 2>nul
+REM JVM options: base options always; --add-opens only for Java 9 and above
 set 
"IOTDB_CLI_PARAMS=-Dlogback.configurationFile=%IOTDB_CLI_CONF%\logback-cli.xml"
-set "JVM_OPTS=-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 
--add-opens=java.base/java.lang=ALL-UNNAMED"
+set "JVM_OPTS=-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8"
+if not "%JAVA_MAJOR%"=="8" if not "%JAVA_MAJOR%"=="" (
+    set "JVM_OPTS=!JVM_OPTS! --add-opens=java.base/java.lang=ALL-UNNAMED"
+)
 
 REM Run CLI
 "%JAVA%" %JVM_OPTS% %IOTDB_CLI_PARAMS% -cp "%CLASSPATH%" %MAIN_CLASS% 
%PARAMETERS%

Reply via email to