Issue
How to execute a jar from OS Process Sampler in Linux? I have the following sampler which is working fine in Windows. How to execute this OS Process Sampler in Linux?
Solution
Linux equivalent would be something like:
- Command:
/bin/bash
(or other Unix Shell which may be different) - Working directory: like on Windows specify the working folder for the command
Command parameters:
-c
- according to bash user manual-c string
If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.
your actual command. If the command includes spaces or any other special characters which need escaping - either escape them using
\
sign or surround the command with double quotation marks""java -jar myjar.jar param1 param2""
Remember that in Linux file names are case sensitive so change Java
to java
as from Linux point of view these 2 are totally different beasts.
Example Configuration:
Example Output:
Check out How to Run External Commands and Programs Locally and Remotely from JMeter for comprehensive explanation of this and other approaches.
Answered By - Dmitri T