最佳答案
Linux 等效项类似于:
- 命令:
/bin/bash
(或其他可能不同的 Unix Shell) - 工作目录:就像在 Windows 上一样,指定命令的工作文件夹
命令参数:
-c
- 根据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.
您的实际命令。如果命令包含空格或任何其他需要转义的特殊字符 - 使用
\
符号转义它们或用 双 引号将命令引起来""java -jar myjar.jar param1 param2""
请记住,在 Linux 中文件名区分大小写,因此将 Java
更改为 java
,因为从 Linux 的角度来看,这两个是完全不同的野兽。
示例配置:
示例输出:
查看How to Run External Commands and Programs Locally and Remotely from JMeter有关此方法和其他方法的全面解释。
关于linux - 如何在 Linux 中从 OS Process Sampler 执行 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38181399/