From 8f313a4027e3f6065c146305e9d79a228061a1f7 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 19 Aug 2026 19:05:55 +0200 Subject: [PATCH] Improve Java version parsing logic to gloss over warning messages I am trying to start Solr in a Docker container in a virtual `arm64` Linux machine on Apple Silicon hardware. To my knowledge, this configuration does (currently?) not support SVE vector length detection. When `bin/solr` runs `java -version`, this makes the JVM emit a notice: ``` Starting Solr Your current version of Java is too old to run this version of Solr. We found major version , using command '/opt/java/openjdk/bin/java -version', with response: OpenJDK 64-Bit Server VM warning: Unable to get SVE vector length on this system. Disabling SVE. Specify -XX:UseSVE=0 to shun this warning. openjdk version "25.0.3" 2026-04-21 LTS OpenJDK Runtime Environment Temurin-25.0.3+9 (build 25.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-25.0.3+9 (build 25.0.3+9-LTS, mixed mode, sharing) Please install latest version of Java 21 or set JAVA_HOME properly. ``` Version detection trips over this extra warning line. So, improve version parsing logic to go over warning lines and lock to the first `version` line. --- solr/bin/solr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/bin/solr b/solr/bin/solr index e61808d080c4..509ca6c650ea 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -175,7 +175,7 @@ if [[ $? -ne 0 ]] ; then echo >&2 "${PATH}" exit 1 else - JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | head -1 | awk -F '"' '/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//') + JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | awk -F '"' '/ version "/ {print $2; exit}' | sed -e's/^1\.//' | sed -e's/[._-].*$//') if (( JAVA_VER_NUM < JAVA_VER_REQ )) ; then echo >&2 "Your current version of Java is too old to run this version of Solr." echo >&2 "We found major version $JAVA_VER_NUM, using command '${JAVA} -version', with response:"