如何在Linux / CentOS中从JMeter执行jar文件

时间:2016-07-03 04:28:45

标签: linux jar centos jmeter

我有一个jar文件,我可以从JMeter Bean Shell Sampler执行,如下所示。

cmd /c java -jar myjar.jar param1

如何从Linux / CentOS中的JMeter执行相同的jar文件?

1 个答案:

答案 0 :(得分:0)

只需Runtime.exec()方法,如

#container > :last-child {
    margin-bottom: 3em;
}

另请注意,JMeter提供OS Process Sampler,因此您无需执行Beanshell脚本即可执行命令和程序。有关详细说明和演练,请参阅How to Run External Commands and Programs Locally and Remotely from JMeter文章。

任何方法的建议都很少:

  • 在Windows上,在文件路径中使用正斜杠,例如:

    Runtime.getRuntime().exec("your command here");
    
  • 使用任何程序的完整路径以防万一

    c:/folder/otherfolder/file