5

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...
Urdesh Kumar
  • 1,120
  • 1
  • 17
  • 23

6 Answers6

8

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.

BatScream
  • 19,260
  • 4
  • 52
  • 68
3

from your error message we can see your JAVA_HOME points to

C:\Program Files (x86)\Java\jdk1.7.0_25\bin

while it should point to

C:\Program Files (x86)\Java\jdk1.7.0_25
FrederikT
  • 31
  • 2
1

I think the error message is fairly descriptive , you should look in this folder is java.exe there ? If not then your JAVA_HOME environment variable to point to the correct installation

heres a page showing how to do that https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows

1st hit on google.

Shaun Hare
  • 3,771
  • 2
  • 24
  • 36
  • I think My environment variable path is fine. JAVA_HOME = C:\Program Files (x86)\Java\jdk1.7.0_25\bin is there can be problem for above error with elastic search? – Urdesh Kumar Jan 29 '14 at 10:28
  • is the executable there though? – Shaun Hare Jan 29 '14 at 10:31
  • also make sure you have installed the latest bits for the JDK (Java development kit),and the version of JAVA is appropriate for your elastic search installation – Shaun Hare Jan 29 '14 at 10:34
  • Note this https://github.com/elasticsearch/elasticsearch/issues/3928 Are you running appropriate version of ES? – Shaun Hare Jan 29 '14 at 10:38
1

Either JAVA_HOME points to the wrong location or you don't have Java installed. Check and see if there's an install of Java in the location specified.

Also note that the JAVA_HOME variable should point to the root of the Java install not the /bin folder. This is being added by the program you're executing.

To change the JAVA_HOME variable to test further use the following in the command prompt:

set JAVA_HOME=c:\xxxx

Once you've established the correct value to use this can be permanently changed in Control Panel>>System>>Advanced System Settings>>Advanced>>Environment Variables

Craig Manson
  • 169
  • 3
  • Is it a possible permissions problem? Try executing the following from the command prompt you're trying to install in: C:\Program Files (x86)\Java\jdk1.7.0_25\bin\java.exe – Craig Manson Jan 29 '14 at 11:27
1

set JAVA_HOME=C:\Program Files (x86)\Java

Above must fix the issue, I came across the same issue while installing the elastic search. i gave a try by giving "bin" part of path but it did not work, so i just give the top folder "java" in path, it worked.

raj
  • 11
  • 1
0

Just to add my own experience. i was setting JAVA_HOME using tab autocompletion. It ends up something like "C:\Program files...:" and it didn't work saying that it cannot find the java program. I solved typing the JAVA_HOME path in the set command without using tab completion. The problem was probably related to the " in the env variable