JMeter unknown arg ?t
Asked Answered
L

10

14

I'm trying to run JMeter in non-gui mode (from the command line).

I've seen in a number of places, including the official docs, that this following command will do what I want:

jmeter -n –t test.jmx -l testresults.jtl

However, I get an illegal argument exception for the "t" argument. See below for my console output:

Console screenshot showing output from the command

Below is the output saved to jmeter.log:

2016/08/09 14:41:59 INFO  - jmeter.util.JMeterUtils: Setting Locale to en_GB 
2016/08/09 14:41:59 INFO  - jmeter.JMeter: Loading user properties from: C:\apache-jmeter-3.0_src\apache-jmeter-3.0\bin\user.properties 
2016/08/09 14:41:59 INFO  - jmeter.JMeter: Loading system properties from: C:\apache-jmeter-3.0_src\apache-jmeter-3.0\bin\system.properties 
2016/08/09 14:41:59 FATAL - jmeter.JMeter: An error occurred:  java.lang.IllegalArgumentException: Unknown arg: –t
    at org.apache.jmeter.JMeter.initializeProperties(JMeter.java:746)
    at org.apache.jmeter.JMeter.start(JMeter.java:385)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.jmeter.NewDriver.main(NewDriver.java:259)
Lorin answered 9/8, 2016 at 13:47 Comment(3)
Place your script file "TwoMinuteTest.jmx" into your JMeter bin directory and then try this command: "jmeter -n –t TwoMinuteTest.jmx -l testresults.jtl"Fair
I swear I tried this earlier, and it didn't work. I just tried it again, and it didn't work again. Then I removed the "-t" and typed it out again, and it worked!! Is there a subtle difference in typing a command and copying it from a text editor or something?Lorin
Stick this in an answer if you like and I'll mark it up when I can.Lorin
L
28

So the issue was how I was getting the command into the command line.

When I copied and pasted my command, it was copied from a webpage, into notepad, and then into the command line. I wrongly assumed notepad would encode the correct character.

Just a bit confusing as the -n worked but not -t. Silly error!

Lorin answered 9/8, 2016 at 15:29 Comment(0)
F
2

Place your script file "TwoMinuteTest.jmx" into your JMeter bin directory and then try this command:

jmeter -n –t TwoMinuteTest.jmx -l testresults.jtl

Fair answered 11/8, 2016 at 3:38 Comment(1)
Hi, thanks for the answer. I've tested this since and the issue occured when I tried to copy and paste the command into the console.Lorin
T
2

I just got the same error, and it turned out that instead of a regular hyphen (aka "minus sign"), the character was a en-dash, and they look similar enough for me not to notice.

Turns out that the Linux version of JMeter (or if it is Linux itself) is very picky, and only accepts the plain regular hyphen character. While the Windows version of JMeter handles both. I copy pasted from a command line example on a website, and I guess that person had run it on Windows and not tried it on Linux.

I think this was the same thing that happened to the original poster here. Posting this as an answer since it is still can happen, and no answer talked about the possibility that the wrong character was used.

Tolbooth answered 9/9, 2020 at 12:47 Comment(0)
I
1

You must keep your .jmx file in jmeter bin folder and you can change your log file location anywhere you wish.

jmeter -n –t TwoMinuteTest.jmx -l C:\users\desktop\Log.Txt -- Will create a text file as log.

jmeter -n –t TwoMinuteTest.jmx -l C:\users\desktop\Log.Csv -- Will create a Csv file as log.

jmeter -n –t TwoMinuteTest.jmx -l C:\users\desktop\Log.Xls -- Will create a Xls file as log.

If the log file is not there in the location, it will create a new file while running the test.

Intradermal answered 8/4, 2019 at 11:37 Comment(0)
A
1

Open .bat file in notepad++ select encoding as Encode in UTF-8 from menu if your file is having any special character correct it using below format: jmeter -n –t "testscript.jmx" -l "results_test.jtl"

Acea answered 10/10, 2019 at 6:2 Comment(0)
C
0

Earlier my TimersTestPlan.jmx had a space , like this Timers TestPlan.jmx When I removed the space it worked for me in windows.

jmeter -n -t C:\FREESOFT\JmterPlanLoc\TimersTestPlan.jmx -l C:\FREESOFT\JmterPlanLoc\Export\Clreport.csv
Coolish answered 8/7, 2021 at 15:51 Comment(0)
P
0

This Worked Perfectly:

jmeter -n -t "F:\WebsitePerformanceTest.jmx" -l "F:\TestResults.csv" -e -o "F:\Reports"
Psychomancy answered 18/9, 2021 at 10:51 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Mccarty
M
0

check-in your

  1. file extension example space, double dots
  2. Install JMeter plugin
  3. Java JDK and JMeter version miss-match.
Melvamelvena answered 28/2, 2022 at 9:41 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Mccarty
Q
0

Instead of:

jmeter -n –t test.jmx -l testresults.jtl

You should use:

jmeter -n –t "test.jmx" -l "testresults.jtl"

This helped me a when getting

Unknown arg error level 1.

Quartziferous answered 4/5, 2023 at 19:57 Comment(0)
C
-1

Instead of:

jmeter -n –t test.jmx -l testresults.jtl

You should use:

jmeter -n –t "test.jmx" -l "testresults.jtl"
Callista answered 1/5, 2019 at 5:42 Comment(1)
Would you like to explain how/why this helps?Spancel

© 2022 - 2024 — McMap. All rights reserved.