Not able to start elastic search service

Just do the following steps step by step and then your elastic search installation will work: advanced system setting >> Environment variables >> System Variables >> path >> New and then insert your latest java jdk path. like this: C:\Program Files\Java\jdk-11.0.3\bin


There is a very high probability that your Java Runtime Environment was auto-updated.

This will break Elastic Search because you have an environment variable called JAVA_HOME that is now pointed at the wrong location.

First, go into program files / java and find the new folder of JRE. It is probably a later version number. Example: instead of jre1.8.0_73, perhaps jre1.8.090 or some higher number tacked onto the end.

Update your JAVA_HOME environment variable accordingly.

Then, after taking appropriate backups of your elastic search files, in an admin-enabled command prompt, navigate to your elastic search bin folder.

type the following commands

 service remove
 service install

Then, you will probably want to go into services.msc and switch the service from "manual start" to "automatic" or "automatic delayed"

One might think that reinstalling the service after updating the JAVA_HOME environment variable would be unnecessary, but it was necessary for my installation.


For me it was caused by a problem in my registry after updating Java. It seemed that older versions of the service installer hardcoded the java path in the registry keys while they should depend on the JAVA_HOME environment variable.

Locate the following key in your registry: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\elasticsearch-service-x64\Parameters\Java\Jvm. If it looks like a hardcoded path to jvm.dll, change the value to %JAVA_HOME%\bin\server\jvm.dll and try starting the service.


Resolved, by install service again..

Open

{path-to-elastic-search}\bin\

in command prompt,

and run

service install

It would not allow me to run

service remove, so I now how two elastic search services listed, however, this is a test server, so that's fine.