0
votes

I'm trying to run the JMeter test using the TFS build definition. I've created the required task to run the JMeter test (command-line task), but I'm getting the following error:

Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Press any key to continue . . .

I've checked the java version on the agent:

I've checked the java version on the agent:

I've mentioned the following system variables:

  • JMETER_HOME as C:\Performance Tests\apache-jmeter-3.2
  • JRE_HOME as "C:\Program Files\Java\jre1.8.0_231"
  • to the Path variable was added C:\Performance Tests\apache-jmeter-3.2\bin;C:\Program Files\Java\jre1.8.0_231\bin

When I try to run the JMeter on the agents I don't get any error: enter image description here

Windows Server 2012 R2 64 bit is installed on the agent.

On another agent (which is the same and has similar configs) the test is running with no issues.

Could someone tell me what is the reason for the issue? Thank you in advance ????

1
Do you have jdk (not jre) folder in C:\Program Files\Java\? - user7294900
@user7294900 No, just jre - user270219
This is the issue, Find jdk folder or you need to reinstall java - user7294900
I noticed that System capabilities in TFS for this agent does not contain java variables (like java_home, etc.). Could that be the reason for the issue? - user270219
When you install java you should choose jdk folder and use it as JAVA_HOME - user7294900

1 Answers

0
votes

Looking into jmeter.bat source:

for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
    rem @echo Debug Output: %%g
    set JAVAVER=%%g
)
if not defined JAVAVER (
    @echo Not able to find Java executable or version. Please check your Java installation.
    set ERRORLEVEL=2
    goto pause
)

it appears that the JMeter startup script is not capable of parsing the output of java -version command in order to determine Java runtime version

So make sure to have "bin" folder of your JRE or JDK installation added to your operating system PATH environment variable

In order to have 100% confidence that it will work add this line to the beginning of your jmeter.bat script:

set PATH="C:\Program Files\Java\jre1.8.0_231\bin";%PATH%

also be aware that according to 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article you should always be using the latest version of JMeter so consider upgrading to JMeter 5.2.1 (or whatever is the latest stable version available at JMeter Downloads page) on next available opportunity