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

**URL:** <https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719>\
**Category:** Logstash\
**Created:** [November 9, 2021, 7:52am UTC](https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719 "2021-11-09T07:52:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Clark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_clark/32/44467_2.png) [@Ryan\_Clark](https://discuss.elastic.co/u/Ryan_Clark)\
**Post date:** [November 9, 2021, 7:52am UTC](https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719/1 "2021-11-09T07:52:51Z")

</div>

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.

```auto
@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

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 9, 2021, 5:35pm UTC](https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719/2 "2021-11-09T17:35:11Z")

</div>

> [@Ryan\_Clark](#):
>
> No 'java.exe' executable found on PATH

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](https://github.com/jruby/jruby-launcher/blob/7366acf974255c68fc55b6a1f600362005a0eec1/platformlauncher.cpp#L143) looks at -Xjdkhome, JAVA\_HOME, and PATH, so it is unaffected by this.

I suggest you set JAVA\_HOME or PATH.

---

<div class="post-metadata">

**Author:** ![Ryan\_Clark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_clark/32/44467_2.png) [@Ryan\_Clark](https://discuss.elastic.co/u/Ryan_Clark)\
**Post date:** [November 9, 2021, 5:51pm UTC](https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719/3 "2021-11-09T17:51:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ryan\_Clark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_clark/32/44467_2.png) [@Ryan\_Clark](https://discuss.elastic.co/u/Ryan_Clark)\
**Post date:** [November 10, 2021, 7:26am UTC](https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719/4 "2021-11-10T07:26:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ryan\_Clark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_clark/32/44467_2.png) [@Ryan\_Clark](https://discuss.elastic.co/u/Ryan_Clark)\
**Post date:** [November 10, 2021, 6:05pm UTC](https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719/5 "2021-11-10T18:05:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 8, 2021, 6:06pm UTC](https://discuss.elastic.co/t/logstash-keystore-bat-not-using-bundled-jdk-windows/288719/6 "2021-12-08T18:06:28Z")

</div>

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