【问题标题】:logstash can't find jdklogstash 找不到 jdk
【发布时间】:2018-07-20 19:11:48
【问题描述】:

我想开始使用 logstash 和弹性搜索。我遵循了 elastic 的文档

https://www.elastic.co/guide/en/logstash/current/getting-started-with-logstash.html

我想从第一个演示命令开始。我在 Windows 10 64 位上工作。于是我下载了logstash.zip,打开了cmd,移到了

C:\Program Files\Logstash\logstash-6.3.1\bin>

文件夹。之后我进入了

logstash -e '输入{标准输入{}}输出{标准输出{}}'

然后我得到一个错误

文件\Java\jdk1.8.0_144\bin 无法找到或加载。 (对不起,我用德语开发,我不知道英文错误信息)

我在这台电脑上运行 eclipse 和 Java 以及命令

javac

表演

> Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are used
  -classpath <path>          Specify where to find user class files and annotation processors
  -cp <path>                 Specify where to find user class files and annotation processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -parameters                Generate metadata for reflection on method parameters
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -h <directory>             Specify where to place generated native header files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release
  -target <release>          Generate class files for specific VM version
  -profile <profile>         Check that API used is available in the specified profile
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system
  -Werror                    Terminate compilation if warnings occur
  @<filename>                Read options and filenames from file

java-版本

输出

java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

所以我想这应该没问题。 谁能帮我为什么logstash找不到它?我必须设置一些额外的东西吗? 在系统变量中,我将 jdk 和 jre 设置为“路径”变量,并在用户变量中创建了一个 JAVA_HOME 变量。 提前致谢

【问题讨论】:

  • "文件\Java\jdk1.8.0_144\bin 无法找到或加载。"路径缺少前缀 - “C:\Program”。这只是复制/粘贴错误,还是实际错误中的情况?
  • 这是错误语句:Error: Main class Files\Java\jdk1.8.0_144\bin;C:\Program could not be found or loaded
  • "Files\Java\jdk1.8.0_144\bin" 看起来像一个不完整的路径。当“javac”和“java”为你工作时——什么是logstash?脚本?可执行文件?也许那里混杂了一些东西。如果可能的话,您能否将相关的环境变量添加到您的问题中。
  • 我下载了 zip 文件。打开包装,就是这样。文档仅此而已
  • 您可以尝试将您的logstash安装移动到C:\Logstash\logstash-6.3.1\bin&gt;之类的位置,这样您的路径就没有空间了。

标签: java logstash


【解决方案1】:

看起来你的 JAVA_HOME 和 PATH 搞砸了。它必须是这样的

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_25 
PATH = C:\Program Files\Java\jdk1.7.0_25\bin

要交叉检查,您可以在终端中尝试此操作

echo %JAVA_HOME%

javac -version

检查类 PATH 变量。

您可以参考this link 逐步设置变量的过程。

【讨论】:

  • echo %JAVA_HOME% 返回 C:\Program Files\Java\jdk1.8.0_144 javac -version 不起作用。只有 java -version,它说 java 版本“1.8.0_171”Java(TM) SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11,混合模式)跨度>
  • javac -version 也应该可以工作。你能检查一下你是否正确设置了 PATH 变量。由于 PATH 变量包含由分号分隔的多个条目。参考这个javatutorial.net/set-java-home-windows-10
  • 感谢您的链接。我按照说明进行操作,现在两者都可以工作。 javac -version 输出 javac 1.8.0_144 和 echo 输出 C:\Program Files\Java\jdk1.8.0_144 但logstash仍然显示相同的错误
猜你喜欢
  • 1970-01-01
  • 2015-11-24
  • 2012-07-20
  • 1970-01-01
  • 1970-01-01
  • 2022-01-22
  • 2011-12-23
  • 2011-08-20
  • 2019-06-16
相关资源
最近更新 更多