Home > Enterprise >  How to run JMeter through CMD from jdk/bin directory?
How to run JMeter through CMD from jdk/bin directory?

Time:02-15

I want to run JMeter test plans from a UNIX server where env variables for java is not set. Its a test server and I dont have access to set that. We have different JDK versions and all are sitting in directories. I need to run my JMeter TestPlans on this server. I went to JDK /bin folder and tired to execute the below command

$ {jmeter-path}/bin/jmeter -nt testplan.jmx -l testresult.jtl

but this says

./bin/java: not found

But if I do simple java -version it shows the version result.Is that something that JMeter needs specifically the java env variable set or it wont run ? I dont have permission to set and I want to run the testplan using the JDK/JRE from its directories. A help would be appreciated. Thanks in advance!

CodePudding user response:

JMeter looks for java executable in system PATH so you have 2 options:

  1. Add bin folder of your JDK or JRE to PATH, something like:

    PATH=$PATH:/location/of/your/jbk/bin && export PATH && {jmeter-path}/bin/jmeter -nt testplan.jmx -l testresult.jtl
    
  2. Or if you have java in PATH just run ApacheJMeter.jar like:

    java -jar {jmeter-path}/bin/ApacheJMeter.jar
    
  3. You might also want to use jmeter.sh wrapper script instead of jmeter, it has some logic regarding java binary location

More information: Get Started With JMeter: Installation & Tests

CodePudding user response:

The official JMeter Getting Started documentation says this:

To install a release build, simply unzip the zip/tar file into the directory where you want JMeter to be installed. Provided that you have a JRE/JDK correctly installed and the JAVA_HOME environment variable set, there is nothing more for you to do.

Based on the symptoms that you reported, I think that you have not set JAVA_HOME correctly. It should be set to an absolute path to for your Java installation.

  • Related