12

While trying to execute JMeter from the command line in non-GUI mode I'm getting errorlevel=2 error message.

What I did is,

Navigate to the JMeter bin directory in command prompt.

Run the command "jmeter -n -t [jmx file] -l [jtl file]"

and it returned errorlevel=2 error message.

Jmeter is working perfectly fine in the GUI mode and Java is also installed properly on my system. The non-GUI mode execution somehow doesn't seem to work!

[I found a workaround which I have written below. If anyone has a better solution then do provide !]

  • Did you set all JAVA related classpath properly? – Helping Hands Jan 6 '16 at 4:28
  • 1
    If you are using windows 8 or above then try the same after running command prompt as administrator. If not then please provide more details about your environment as it is env related issue. – TestingWithArif Jan 6 '16 at 5:04
  • 1
    It will be helpful if you can also share the actual jmeter command that you are running. – TestingWithArif Jan 6 '16 at 5:05
  • 5
    The command in the question is the actuale command if you replace your actual jmeter test plan and results files. jmeter -n -t D:\PerformanceTest.jmx -l D:\Result.jtl – IAmMilinPatel Jan 6 '16 at 5:28
10

Answering the comments above,

Well I had Java and Jmeter installed correctly with ClassPath and everything. I also tried running Command Prompt as Administrator but got the same result. There was no problem in that. That is why the GUI version was working properly in first place.

After a lot of R&D and Googling I found out that the problem was with the findstr command in the jmeter.bat file.

To fix this you need to do the following:

  1. Go to Properties of the "My Computer" or "This PC" on the desktop (Right click and select Properties).
  2. In Windows 8 select Advances System Properties in the window that appears.
  3. Select Environment Variables.
  4. Set Path variable to "C:\WINDOWS\system32".

If Path variable is already set for another path then add a semi-colon(;) at the end and then write the above path and save it.

Now restart your command prompt and run your JMeter test.

  • It did not work for me. I changed the path variable to exactly what you said. I am still stuck. – user27476 Aug 16 '17 at 3:04
  • 5
    What environment you are using JMeter on? Did you check your jmeter.bat file? Is there anything other than findstr that might be causing the issue? – IAmMilinPatel Aug 17 '17 at 4:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.