"JAVA_HOME points to an invalid Java installation issue" with service install command in elastic search

cmd, elasticsearch, java, php

Solution

Open up and Look into the `service.bat` file:

It searches for:

%JAVA_HOME%\bin\java.exe

hence your `%JAVA_HOME%` should not include `bin` in it.

A workaround if you do not have privileges to set up the environmental variables:

open the `service.bat` file,

a) Remove the line:

if NOT DEFINED JAVA_HOME goto err

b) Replace `%JAVA_HOME%` with your java `jdk` path, something like: `C:\Program Files\Java\jdk1.7.0_51`

Note: This is just a workaround which works all the time.

Problem

I want to use elastic search with my PHP application. after running service install command , I am getting fallowing error. ``` C:\elasticsearch-0.90.10\bin>service install JAVA_HOME points to an invalid Java installation (no java.exe found in "C:\Progr am Files (x86)\Java\jdk1.7.0_25\bin"). Existing... ```

Original source