java 找不到logstash的java安装错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30427355/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot locate java installation error for logstash
提问by Asma Zinneera Jabir
I downloaded Logstash-1.5.0 on Windows 8.1 and tried to run it in the command prompt.
我在 Windows 8.1 上下载了 Logstash-1.5.0 并尝试在命令提示符下运行它。
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:
首先我检查了java版本。然后将目录更改为logstash-1.5.0/bin
然后输入命令logstash -e 'input { stdin { } } output { elasticsearch { host => localhost } stdout { } }'
它给出了以下错误:
Cannot locate java installation, specified by JAVA_HOME
找不到 Java 安装,由 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.
Logstash 文件夹在 C: 上,Java 版本为 1.7.0_25。我已经将 JAVA_HOME 环境变量设置为jdk
/bin 目录,但仍然不起作用。
I'm new to Logstash. Can somebody tell me in detail why this happens and help me fix it?
我是 Logstash 的新手。有人可以详细告诉我为什么会发生这种情况并帮助我解决吗?
回答by Razib
Set the JAVA_HOME
and PATH
environmental variables like this:
设置JAVA_HOME
和PATH
这样的环境变量:
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_25
PATH = C:\Program Files\Java\jdk1.7.0_25\bin
回答by Tomá? Fejfar
In my case the problem was that I set the JAVA_HOME
variable with a space in the end:
就我而言,问题是我最后JAVA_HOME
用空格设置了变量:
"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.
而 logstash 无法弄清楚:) 删除空间解决了这个问题。
回答by Rene M.
On Windows when you change environment over the system settings, you have to close and reopen the command shell, before the changes take effect.
在 Windows 上,当您通过系统设置更改环境时,您必须在更改生效之前关闭并重新打开命令外壳。
Step by step:
一步步:
- Locate your java JRE installation directory you want to use. For example: "C:\Program Files\Java\jre7"
- Open start menu right click computer and select settings. In System settings window on right side click on "Extended Systemsettings".
- On Tab extended select environment variables, add your
JAVA_HOME
variable to your path and hit OK. - Open command shell and check environment by entering "set" and hit enter. Look if
JAVA_HOME
is set.
- 找到您要使用的 java JRE 安装目录。例如:“C:\Program Files\Java\jre7”
- 打开开始菜单右键单击计算机并选择设置。在右侧的系统设置窗口中,单击“扩展系统设置”。
- 在选项卡扩展选择环境变量上,将您的
JAVA_HOME
变量添加到您的路径并点击确定。 - 通过输入“set”打开命令外壳并检查环境并按回车键。看是否
JAVA_HOME
设置。
If your JAVA_HOME
is now correctly set, logstash should work.
如果您JAVA_HOME
现在正确设置,logstash 应该可以工作。