Logstash-keystore.bat not using bundled JDK (Windows)

I was trying to setup a keystore and when running .\logstash-keystore.bat I get a message saying "Using bundled JDK: "" then it says, No 'java.exe' executable found on PATH. I'm running version 7.15.1. The crazy thing is when I try to manual execute logstash, it finds the bundled java path and tries to start....obviously it does not start because my keystore is not set up.

Here is what the logstash-keystore.bat file looks like.

@echo off
setlocal enabledelayedexpansion

call "%~dp0setup.bat" || exit /b 1
if errorlevel 1 (
    if not defined nopauseonerror (
        pause
    )
    exit /B %ERRORLEVEL%
)

%JRUBY_BIN% "%LS_HOME%\lib\secretstore\cli.rb" %*
if errorlevel 1 (
    exit /B 1
)

endlocal

That feels a lot like a bug to me. bin/setup.bat sets the JAVA environment variable, which is what the other elastic .bat scripts use to find java. However, the jruby process launcher looks at -Xjdkhome, JAVA_HOME, and PATH, so it is unaffected by this.

I suggest you set JAVA_HOME or PATH.

Yeah, I thought about that but Elasticsearch is on the same node so I was worried Elasticsearch would try to use that path over its own bundled JDK. I'll give it a shot and see what happens.

I still haven't tried to set the path but I did try versions 7.14.2 and 7.15.0 in addition to 7.15.1 and got the same results.

OK, so I was hesitant to set a system wide JAVA_HOME env variable so I found a way to ephemerally set it in PowerShell:
$env:JAVA_HOME = "C:\Path\To\logstash-7.x.x\jdk"

This worked and doesn't impact Elasticsearch.

Thanks for the help.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.