title: How to pass JMeter properties through java
body: <p>I am trying to run jmeter through java.
  The examples from <a href="https://www.blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui" rel="nofollow">https://www.blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui</a></p>
  
  <p>I uploaded jmx file like was described in example.</p>
  
  <p>In the jmx file I have properties. Properties specified like ${__property(0_users,,0)}</p>
  
  <p>I manged to upload this property through command line using -J parameter.</p>
  
  <p>How can I specify parameters through java. I didn't find any info regarding this. </p>
  
  <p>Does exist some way to specify it directly in java ? 
          StandardJMeterEngine jmeter = new StandardJMeterEngine();</p>
  
  <pre><code>    // Initialize Properties, logging, locale, etc.
      JMeterUtils.loadJMeterProperties("C:\\jMeter\\apache-jmeter-2.13\\bin\\jmeter.properties");
      JMeterUtils.setJMeterHome("C:\\jMeter\\apache-jmeter-2.13");
  
      JMeterUtils.initLogging();// you can comment this line out to see extra log messages of i.e. DEBUG level
      JMeterUtils.initLocale();
  
      // Initialize JMeter SaveService
      SaveService.loadProperties();
  
      // Load existing .jmx Test Plan
      File jmxFile = new File("C:\\jMeter\\test.jmx");
      HashTree testPlanTree = SaveService.loadTree(jmxFile);
  
      jmeter.configure(testPlanTree);
      jmeter.run();
  </code></pre>