java 无法运行 Jmeter.bat
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33777617/
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
Unable to run Jmeter.bat
提问by pledgeX
I'm trying to use Jmeter but am coming across an issue when I try and run it using the Jmeter.bat file.
我正在尝试使用 Jmeter,但是当我尝试使用 Jmeter.bat 文件运行它时遇到了一个问题。
It's spits out the following error:
它吐出以下错误:
'java -version 2>&1 | findstr /i "version"' is not recognized as an internal or external command, operable program or batch file.
Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Press any key to continue . . .
I've tried googling this and lots of posts mention that this error is usually down to the environment variables not being set correctly, but I'm fairly sure they are as if I type java or javac into the command prompt I get a response.
我试过在谷歌上搜索这个,很多帖子都提到这个错误通常是由于环境变量设置不正确,但我很确定它们就像我在命令提示符中输入 java 或 javac 一样我得到了响应。
I've got them set as follows:
我已经将它们设置如下:
- JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
- JDK_HOME : %JAVA_HOME%
- JRE_HOME : %JAVA_HOME%\jre
- CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
- PATH : your-unique-entries;%JAVA_HOME%\bin
- JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
- JDK_HOME : %JAVA_HOME%
- JRE_HOME : %JAVA_HOME%\jre
- 类路径:.;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
- 路径:您的唯一条目;%JAVA_HOME%\bin
I tried taking the string it's complaining about and pasted that into the command prompt by itself and it ran fine:
我试着把它抱怨的字符串单独粘贴到命令提示符中,它运行良好:
C:\Windows\System32>java -version 2>&1 | findstr /i "version"
java version "1.8.0_25"
So why is it throwing the error when running the batch file but not if I paste it in manually? The batch file is located in a folder in my C drive and I'm running by right clicking and selecting 'Run as Administrator'. If I just double click the .bat file I get the error:
那么为什么在运行批处理文件时会抛出错误,但如果我手动粘贴它不会呢?批处理文件位于我的 C 驱动器中的文件夹中,我通过右键单击并选择“以管理员身份运行”来运行。如果我只是双击 .bat 文件,我会收到错误消息:
Windows cannot find 'C:\apache-jmeter-2.13_src\bin\jmeter.bat'. Make sure you typed the name correctly, and then try again
Is the above error related or is that a separate permissions issue?
上述错误是相关的还是单独的权限问题?
Thanks for any help
谢谢你的帮助
回答by Abhay Dixit
From command Prompt go to bin folder of apache jmeter and type following command:
C:\apache-jmeter-3.0\bin>java -jar ApacheJmeter.jar
从命令提示符转到 apache jmeter 的 bin 文件夹并键入以下命令:
C:\apache-jmeter-3.0\bin>java -jar ApacheJmeter.jar
回答by murali koripally
I also faced similar problem when I extracted the JMeter in C. In my case, i don't have admin rights. I assume it is related to some permission issue. So better copy to D: and then check.
当我在 C 中提取 JMeter 时,我也遇到了类似的问题。就我而言,我没有管理员权限。我认为这与某些权限问题有关。所以最好复制到 D: 然后检查。
Copy C:\apache-jmeter-2.13_src folder to other drive (D:) or download JMeter and extract in D drive and run the batch file.
将 C:\apache-jmeter-2.13_src 文件夹复制到其他驱动器(D:)或下载 JMeter 并解压到 D 驱动器并运行批处理文件。