How to execute java class from Jmeter

20,822

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

Share:
20,822
ant
Author by

ant

www.linkedin.com/in/ibrahimbegovic

Updated on January 21, 2020

Comments

  • ant
    ant over 4 years

    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.

  • Mikhail T.
    Mikhail T. almost 11 years
    Wouldn't that be the same as Beanshell Sampler?
  • Venura
    Venura over 3 years
    For anyone still looking for answer after so many years just like me, you can use JSR223 Sampler. dzone.com/articles/…