# Elasticsearch 7.16.2 fails to start as service under windows server 2019

**URL:** <https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708>\
**Category:** Elasticsearch\
**Created:** [December 22, 2021, 3:42pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708 "2021-12-22T15:42:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yankun0567](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yankun0567/32/71796_2.png) [@yankun0567](https://discuss.elastic.co/u/yankun0567)\
**Post date:** [December 22, 2021, 3:42pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/1 "2021-12-22T15:42:53Z")

</div>

Hi,

I've just downloaded Elasticsearch 7.16.2 and installed it as a service under Windows Server 2019. Previously I had 7.10.2. running without any issues.

If I'm trying to start the service, it fails with following error:

```auto
[2021-12-22 15:33:27] [info] [3612] Starting service...
[2021-12-22 15:33:27] [error] [4972] CreateJavaVM Failed
[2021-12-22 15:33:27] [error] [4972] The system cannot find the file specified.
[2021-12-22 15:33:27] [error] [3612] Failed to start Java
[2021-12-22 15:33:27] [error] [3612] ServiceStart returned 4

```

I've tried the bundled JDK and OpenJDK 15.0.2, both produce the same result.

Whats going on? It is just the extracted zip file, no config changes or what so ever.

EDIT:

Tried to start the Elasticsearch.bat directly and getting follwing error:

```auto
Error: Could not find or load main class Files\elasticsearch-7.10.2\tmp
Caused by: java.lang.ClassNotFoundException: Files\elasticsearch-7.10.2\tmp

```

SO somehow this is related to the previous 7.10.2 installation, but I've no idea how to get rid of that?

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [December 22, 2021, 4:16pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/2 "2021-12-22T16:16:10Z")

</div>

Double check your JAVA\_HOME PATH. That may be causing issues.

---

<div class="post-metadata">

**Author:** ![yankun0567](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yankun0567/32/71796_2.png) [@yankun0567](https://discuss.elastic.co/u/yankun0567)\
**Post date:** [December 22, 2021, 4:19pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/3 "2021-12-22T16:19:18Z")

</div>

Hi, of course I did that, that would be to easy! 🙂

As mentioned, with newer versions this is no longer required. Without the path, the bundled JDK will be used. Also, JAVA\_HOME is no longer supported, instead it has to be ES\_JAVA\_HOME.

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [December 22, 2021, 4:21pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/4 "2021-12-22T16:21:15Z")

</div>

Yes. Sorry, was writing on my mobile and just thought of a quick suggestion. Once I get back let me try this out at home.

---

<div class="post-metadata">

**Author:** ![yankun0567](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yankun0567/32/71796_2.png) [@yankun0567](https://discuss.elastic.co/u/yankun0567)\
**Post date:** [December 22, 2021, 4:22pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/5 "2021-12-22T16:22:21Z")

</div>

> [@yankun0567](#):
>
> `Files\elasticsearch-7.10.2\tmp`

No problem. I think it has todo something with the previous installed 7.10.2 version, which put something somwhere into a temp folder I'm now trying to locate...

---

<div class="post-metadata">

**Author:** ![yankun0567](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yankun0567/32/71796_2.png) [@yankun0567](https://discuss.elastic.co/u/yankun0567)\
**Post date:** [December 22, 2021, 4:38pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/6 "2021-12-22T16:38:53Z")

</div>

Ok, I got it. The system had a System Variable ES\_TMP\_DIR set, which pointed to the 7.10.2 installation and 7.16.2 didn't like that. After removing the service, removing the variable and re-installaing the service, it is now finally running (just removing the variable didn't help).

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [December 22, 2021, 4:40pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/7 "2021-12-22T16:40:59Z")

</div>

That's great!

---

<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:** [January 19, 2022, 4:41pm UTC](https://discuss.elastic.co/t/elasticsearch-7-16-2-fails-to-start-as-service-under-windows-server-2019/292708/8 "2022-01-19T16:41:41Z")

</div>

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