jmeter 无法运行!无法找到 Java 可执行文件或版本。请检查您的 Java 安装”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47512762/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:40:00  来源:igfitidea点击:

jmeter wont run !Not able to find Java executable or version. Please check your Java installation"

javajmeter

提问by John Little

I installed java from the offical java download page https://java.com/en/download/win10.jsp

我从官方 java 下载页面https://java.com/en/download/win10.jsp安装了 java

It installed what appears to be a 32bit on my 64 bit system, which I can only guess is OK, as it did not present any other options.

它在我的 64 位系统上安装了似乎是 32 位的,我只能猜测是可以的,因为它没有提供任何其他选项。

I edited my system environtment variables, and added JAVA_HOME and added %JAVA_HOME%\bin to my "user variables" Path definition.

我编辑了我的系统环境变量,并添加了 JAVA_HOME 并将 %JAVA_HOME%\bin 添加到我的“用户变量”路径定义中。

typing "set" in a cmd window produces:

在 cmd 窗口中输入“set”会产生:

JAVA_HOME=C:\Program Files (x86)\Java\jre1.8.0_151
:
Path=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;.....C:\Program Files (x86)\Java\jre1.8.0_151\bin;

At the command prompt, "java -version"

在命令提示符下,“java -version”

produces:

产生:

java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) Client VM (build 25.151-b12, mixed mode)

But when I try to launch jmeter.bat, I get:

但是当我尝试启动 jmeter.bat 时,我得到:

jmeter wont run !Not able to find Java executable or version. Please check your Java installation"

jmeter 无法运行!无法找到 Java 可执行文件或版本。请检查您的 Java 安装”

Any ideas?

有任何想法吗?

回答by user7294900

Your Java home is connected to JRE and not JDK (C:\Program Files (x86)\Java\jre1.8.0_151). See tutorial:

您的 Java 主目录连接到 JRE 而不是 JDK (C:\Program Files (x86)\Java\jre1.8.0_151)。见教程

Windows: Set the environment variable JAVA_HOME to C:\Program Files\Java\jdk1.7.0_25

Windows:将环境变量 JAVA_HOME 设置为 C:\Program Files\Java\jdk1.7.0_25

It should be connected to C:...\jdk[version] path, so set JAVA_HOME as:

它应该连接到 C:...\jdk[version] 路径,因此将 JAVA_HOME 设置为:

set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_151

回答by Dmitri T

  1. If possible move your JRE to folder which doesn't have spaces in its path.
  2. If for some reason it is not possible - surround path to "bin" folder of your JRE installation with quotation marks
  3. In any case you should be able to run JMeter as:

    java -jar ApacheJMeter.jar
    
  1. 如果可能,将您的 JRE 移动到其路径中没有空格的文件夹。
  2. 如果由于某种原因不可能 - 用引号将 JRE 安装的“bin”文件夹的路径括起来
  3. 在任何情况下,您都应该能够将 JMeter 运行为:

    java -jar ApacheJMeter.jar
    

See Setting the JAVA_HOME Variable in Windowsfor more details.

有关更多详细信息,请参阅在 Windows 中设置 JAVA_HOME 变量



I would strongly recommend switching to 64-bit server JRE as on 32-bit one you won't be able to allocate more than 4 GB to JMeterwhich might be not enough when it comes to high loads.

我强烈建议切换到 64 位服务器 JRE,因为在 32位服务器上,您将无法为 JMeter 分配超过 4 GB 的空间,这在高负载时可能还不够。

Check out JMeter Best Practicesand 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failurearticles for more information on tuning JMeter for maximum performance

查看JMeter Best Practices9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure文章,了解关于调优 JMeter 以获得最佳性能的更多信息

回答by Tinashe Chinyanga

Check-out this article, best way to set JAVA_HOME. The long and short of it, if using Windows, download the JDK, open your command prompt and type in the following command: setx -m JAVA_HOME "C:\Progra~1\Java\jdk1.8.0_XX". Normally, the JDK is stored in your C:\Program Files\Java...

查看这篇文章,设置 JAVA_HOME 的最佳方法。总而言之,如果使用 Windows,请下载 JDK,打开命令提示符并键入以下命令: setx -m JAVA_HOME "C:\Progra~1\Java\jdk1.8.0_XX". 通常,JDK 存储在您的 C:\Program Files\Java...