How to execute java class from Jmeter

ant picture ant · Sep 22, 2010 · Viewed 19.5k times · Source

Is there a way to execute java class from jmeter? I've packaged my class with maven assembly and put it in the lib folder of JMETER_HOME. Then I created BSF Listener inside my test case and wrote :

import my.package.name.App;

my.package.name.App app = new my.package.name.App("argument1", "argument2");

Is there another way to execute java class or whatever maybe with java -jar call the jar directly , this class basically creates one big file from the smaller files, which locations are provided by jmeter so it needs to be included in the test because its the part of the flow.

Answer

Adnan picture Adnan · Sep 22, 2010

Try BSF Sampler instead of BSF Listener, in scripting language field select beanshell and it will work like a charm.