Elasticsearch 7.16.2 fails to start as service under windows server 2019

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:

[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:

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?

Double check your JAVA_HOME PATH. That may be causing issues.

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

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.

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.

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...

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).

That's great!