如何从Jmeter运行jar文件? [英] How to run a jar file from Jmeter?

查看:640
本文介绍了如何从Jmeter运行jar文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Bean Shell Sampler中尝试了以下内容;

I tried the following in the Bean Shell Sampler;

Runtime rt = Runtime.getRuntime();
rt.exec("cmd.exe /c && cd /Program Files/Java/jdk1.8.0_51/jre/bin & java -jar File-2.0-SNAPSHOT.WAR");

它看起来像无法运行..我是否以正确的方式进行操作?

It looks like, it is not able to run.. Am i doing in the correct way?

推荐答案

如果需要使用Beanshell,我建议对流程命令行进行以下修改:

If you need to do it with Beanshell, I would suggest the following amendment to the process command line:

cmd /c start java -jar .....

请参见 cmd .exe文档以获取更多信息

但是,在大多数情况下,使用 OS Process Sampler 可能会更容易允许执行任意命令和程序.查看如何运行外部命令和从JMeter本地和远程进行程序

However in majority of cases it might be easier to use OS Process Sampler which allows executing arbitrary commands and programs. Check out How to Run External Commands and Programs Locally and Remotely from JMeter

这篇关于如何从Jmeter运行jar文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆