# How to install Elasticsearch windows service on server with different versions of Java?

**URL:** <https://discuss.elastic.co/t/how-to-install-elasticsearch-windows-service-on-server-with-different-versions-of-java/240854>\
**Category:** Elasticsearch\
**Created:** [July 12, 2020, 6:40pm UTC](https://discuss.elastic.co/t/how-to-install-elasticsearch-windows-service-on-server-with-different-versions-of-java/240854 "2020-07-12T18:40:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)\
**Post date:** [July 12, 2020, 6:40pm UTC](https://discuss.elastic.co/t/how-to-install-elasticsearch-windows-service-on-server-with-different-versions-of-java/240854/1 "2020-07-12T18:40:29Z")

</div>

I have at least two versions of Java on server so JAVA\_HOME points to version 8 not 11.

To start manually start ES I just modified elasticsearch-env.bat:

```
if "%JAVA_HOME%" == "" (
  set JAVA="%ES_HOME%\jdk\bin\java.exe"
  set JAVA_HOME="%ES_HOME%\jdk"
  set JAVA_TYPE=bundled jdk
) else (
  set JAVA="C:\Program Files\Java\jdk-11.0.6\bin\java.exe"
  set JAVA_TYPE=JAVA_HOME
)

```

But I cannot make it work for elasticsearch-service.bat  
I modified several lines including '--Jvm' paramter but still does not work.  
I tried set JAVA\_HOME by adding line set "JAVA\_HOME=C:\Program Files\Java\jdk-11.0.6" but it dost not work.

What should I modify to make it works?

---

<div class="post-metadata">

**Author:** ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)\
**Post date:** [July 14, 2020, 3:05pm UTC](https://discuss.elastic.co/t/how-to-install-elasticsearch-windows-service-on-server-with-different-versions-of-java/240854/2 "2020-07-14T15:05:25Z")

</div>

Anyone can 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:** [August 11, 2020, 3:05pm UTC](https://discuss.elastic.co/t/how-to-install-elasticsearch-windows-service-on-server-with-different-versions-of-java/240854/3 "2020-08-11T15:05:33Z")

</div>

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