“JAVA_HOME points to an invalid Java installation

2019-02-18 03:56发布

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

6条回答
时光不老,我们不散
2楼-- · 2019-02-18 04:07

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.

查看更多
太酷不给撩
3楼-- · 2019-02-18 04:09

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.

查看更多
Juvenile、少年°
4楼-- · 2019-02-18 04:10

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

查看更多
Rolldiameter
5楼-- · 2019-02-18 04:21

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.

查看更多
劳资没心,怎么记你
6楼-- · 2019-02-18 04:29

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
查看更多
We Are One
7楼-- · 2019-02-18 04:29

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

查看更多
登录 后发表回答