Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot locate java installation error for logstash

I downloaded Logstash-1.5.0 on Windows 8.1 and tried to run it in the command prompt.

First I checked the java version. Then changed the directory to logstash-1.5.0/bin then entered the command logstash -e 'input { stdin { } } output { elasticsearch { host => localhost } stdout { } }' it gave the following error:

Cannot locate java installation, specified by JAVA_HOME

The Logstash folder is on C: and the version of Java is 1.7.0_25. I've set the JAVA_HOME environmental variables to the jdk /bin directory, but still it doesn't work.

I'm new to Logstash. Can somebody tell me in detail why this happens and help me fix it?

like image 637
Asma Zinneera Jabir Avatar asked May 24 '15 19:05

Asma Zinneera Jabir


3 Answers

Set the JAVA_HOME and PATH environmental variables like this:

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_25 
PATH = C:\Program Files\Java\jdk1.7.0_25\bin
like image 67
Razib Avatar answered Oct 07 '22 05:10

Razib


On Windows when you change environment over the system settings, you have to close and reopen the command shell, before the changes take effect.

Step by step:

  1. Locate your java JRE installation directory you want to use. For example: "C:\Program Files\Java\jre7"
  2. Open start menu right click computer and select settings. In System settings window on right side click on "Extended Systemsettings".
  3. On Tab extended select environment variables, add your JAVA_HOME variable to your path and hit OK.
  4. Open command shell and check environment by entering "set" and hit enter. Look if JAVA_HOME is set.

If your JAVA_HOME is now correctly set, logstash should work.

like image 42
Rene M. Avatar answered Oct 07 '22 03:10

Rene M.


In my case the problem was that I set the JAVA_HOME variable with a space in the end:

"set JAVA_HOME=c:\Programs\Java " 

instead of

"set JAVA_HOME=c:\Programs\Java"

And logstash couldn't figure that out :) Removing the space fixed the issue.

like image 2
Tomáš Fejfar Avatar answered Oct 07 '22 04:10

Tomáš Fejfar