What does Apache JMeter resolve the special file name `LAST` to in `-t LAST`?
answer
- A convenience for a desktop user
- The GUI is what fills the list
- Java user preferences, not a properties file
- Empty list means no test plan
basics
~20 sThe most recently opened test plan from the JMeter GUI's Open Recent list, which lives in the Java user preferences node for LoadRecentProject. On a host where that user never ran the GUI it resolves to nothing.
solid answer
~40 s`LAST` is a literal magic value. For `-t`, JMeter calls `LoadRecentProject.getRecentFile(0)` and uses the most recent GUI entry as the plan. That list is a Java preferences node keyed `recent_file_0` through `recent_file_8`, written only by the GUI and scoped to the OS user — it is not a JMeter property and does not travel with a repository or an image. `-l` accepts it too, as `LAST` or `LAST.jtl`, and swaps a `.JMX` suffix for `.jtl`. If the list is empty the test file is null, so JMeter prints `Incorrect Usage:Non-GUI runs require a test plan` plus the option list and the JVM ends with status 0 — quieter than naming a missing file, which fails with `The file ... doesn't exist or can't be opened` and exits 1.
go deeper
Recognise LAST as a magic value on -t rather than a real file name, and know it comes from the GUI's recent-file list.
Explain that the list is a Java user-preferences node written by the GUI, and what -l LAST does with a .jmx suffix.
Predict the headless failure: no plan, a usage message, and an exit status of 0 that looks like success to anything watching only the exit code.
Rule LAST out of any unattended invocation and say why: a per-OS-user preference is not a reproducible input to a run.
## Where `LAST` comes from `LAST` is a literal, case-sensitive magic value JMeter recognises in the value of `-t`. When it sees it, JMeter asks `LoadRecentProject.getRecentFile(0)` for the most recent entry in the GUI's Open Recent list and uses that path as the test plan. The important part is where that list lives. It is not a JMeter property and not a file in `bin/`: it is the Java preferences node for the `LoadRecentProject` class, with keys `recent_file_0` through `recent_file_8`. Consequences follow directly: - It is **per operating-system user**, stored wherever the JDK keeps user preferences on that platform. - It is written only by the **GUI**, when a plan is opened or saved there. - It never travels with the repository, a container image, or a copied `bin/` directory. ## `LAST` on `-l` as well `-l` accepts the same magic name, in two spellings, handled by a small helper: - `-l LAST` and `-l LAST.jtl` both trigger it. - JMeter takes the same most-recent path, and if it ends in `.JMX` (compared case-insensitively) replaces that suffix with `.jtl`. So a recent `/plans/checkout.jmx` yields `/plans/checkout.jtl`. - If the recent entry exists but does not end in `.jmx`, the argument is used as typed — you get a file literally named `LAST` or `LAST.jtl`. - If the recent list is **empty**, the helper dereferences a null path: `-l LAST` dies on a `NullPointerException` inside `processLAST`, printing an `An error occurred: Cannot invoke "String.toUpperCase(java.util.Locale)" because "last" is null` line and exiting with status `1`, which is a different failure from the one `-t LAST` produces on the same box. | Flag | `LAST` recognised at 6.0.0? | Result | |---|---|---| | `-t` | yes | The most recent plan path itself | | `-l` | yes, also as `LAST.jtl` | Same path with `.JMX` swapped for `.jtl` | | `-j` | no | The name is only date-pattern expanded; `LAST` stays literal | The manual's option list says `LAST` works for `-t`, `-j` **or** `-l`, and a comment in the source repeats it, but at 6.0.0 the substitution helper is only ever applied to the `-l` argument. `-j LAST` produces a run log in a file called `LAST`. ## What happens when the list is empty On a build agent, a container, or any host where the GUI has never been opened by that OS user, `getRecentFile(0)` returns nothing. `-t LAST` therefore resolves to no test plan at all, and the flow ends like this: 1. JMeter reaches the non-GUI branch with a null test file. 2. It throws `IllegalUserActionException("Non-GUI runs require a test plan")`. 3. The console prints `Incorrect Usage:Non-GUI runs require a test plan` followed by the whole option list. 4. `start` returns normally. Nothing calls `System.exit`, so the JVM ends with status `0`. Contrast that with naming a plan that is simply not there: `-t missing.jmx` reaches the engine setup, fails with `The file <abs path> doesn't exist or can't be opened`, and that path does call `System.exit(1)`. Two adjacent mistakes, two different exit statuses. ## Why `LAST` has no place in an unattended run `LAST` exists for the desktop loop: edit a plan in the GUI, drop to a terminal, re-run exactly what you just had open without retyping the path. It is a convenience for a human at the same machine. For anything unattended it is the wrong tool, for reasons that are all about the preference store rather than about JMeter's engine: - Two OS users on the same host resolve it differently. - It changes the moment somebody opens a different plan in the GUI. - On a fresh agent it resolves to nothing, and the failure mode is a run that prints a usage message and ends cleanly. Name the `.jmx` explicitly, ideally by absolute path, in anything you did not start by hand.
- Does -l LAST mean the last results file that was written?No. It resolves the same recent test plan path and swaps a .JMX suffix for .jtl, so it is derived from the plan, not from any previous results file. If the recent entry does not end in .jmx you get a file literally named LAST.jtl.
- The manual lists -j among the flags that accept LAST. Is that right at 6.0.0?No. The substitution helper is only applied to the -l argument in the 6.0.0 source; the -j value is passed through date-pattern expansion and then used verbatim. `-j LAST` writes a run log to a file named LAST. The manual and an in-source comment are both stale here.
saying these in an interview costs you the question
- Thinks LAST reads a jmeter.properties entry
- Says LAST means the last plan run in CLI mode
- Assumes -l LAST points at the previous results file
- Expects a hard error when the recent list is empty
- Uses LAST in a scheduled or containerised run