Skip to content

Apache Lucene open-source search software

SOLR-8073: Solr fails to start on Windows with obscure errors when using relative path

Shalin Shekhar Mangar77d89d60372c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d887f3f943b..49d76f6e7a9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -419,6 +419,9 @@ Bug Fixes
* SOLR-8307: Fix XXE vulnerability in MBeansHandler "diff" feature (Erik Hatcher)
+* SOLR-8073: Solr fails to start on Windows with obscure errors when using relative path.
+ (Alexandre Rafalovitch, Ishan Chattopadhyaya via shalin)
+
Optimizations
----------------------
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 5f5f6c24b73..71273096440 100644
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -609,11 +609,11 @@ IF NOT "%EXAMPLE%"=="" goto run_example
:start_solr
IF "%SOLR_HOME%"=="" set "SOLR_HOME=%SOLR_SERVER_DIR%\solr"
+IF EXIST "%cd%\%SOLR_HOME%" set "SOLR_HOME=%cd%\%SOLR_HOME%"
+
IF NOT EXIST "%SOLR_HOME%\" (
IF EXIST "%SOLR_SERVER_DIR%\%SOLR_HOME%" (
set "SOLR_HOME=%SOLR_SERVER_DIR%\%SOLR_HOME%"
- ) ELSE IF EXIST "%cd%\%SOLR_HOME%" (
- set "SOLR_HOME=%cd%\%SOLR_HOME%"
) ELSE (
set "SCRIPT_ERROR=Solr home directory %SOLR_HOME% not found!"
goto err
@@ -1240,4 +1240,4 @@ REM Safe echo which does not mess with () in strings
set "eout=%1"
set eout=%eout:"=%
echo !eout!
-GOTO :eof
\ No newline at end of file
+GOTO :eof