title: When Running Jmeter test from java its not using the properties
body: <p>I have a test in JMeter, and with GUI it runs perfectly, but when I run it using my Java code (like from here:
  <a href="http://blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui" rel="nofollow">http://blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui</a>), I can't retrieve the params from the properties.
  If I print them in the beanshell log, I can see them.
  But, when I'm trying to use this params in thread Group as number of users it is not working.</p>
  
  <p>More info:</p>
  
  <ol>
  <li>I have a setUp thread that counts the rows of the csv file and
  inserting a value to a property so that in the next thread I will
  use this property to set the amount of users. (this logic is
  happening twice during the test).</li>
  <li>I'm using Maven dependencies of: <em>ApacheJMeter_http V2.11</em> (2.13 creates a conflict with common-pools2 and d-haven)</li>
  <li>eclipse (if it matters)</li>
  <li>The goal is that the only parameter I will pass to the test run is the test file.</li>
  <li>The prop statement in the test looks like this <code>${__P(paramName)}</code> also tried <code>$(__property{paramName})</code>.</li>
  <li>I have also created a property in the file itself instead of using in beanshell <code>JMeterUtils.setProperty("paramName","5");</code></li>
  </ol>
  
  <p>Adding the bean shell snippet:</p>
  
  <pre><code>import org.apache.jmeter.util.JMeterUtils;
  import java.io.*;
  
  BufferedReader br = new BufferedReader(new FileReader("C:\\res\\movieResultData.csv"));
  String line;
  
  int counter = 0;
  while ((line = br.readLine()) != null) {
     counter++;
  }
  br.close();
  JMeterUtils.setProperty("statsThreadNum",Integer.toString(counter-1));
  </code></pre>
  
  <p>My java Code:</p>
  
  <pre><code>    @Test
  public void ttt() throws Exception {
      // JMeter Engine
      StandardJMeterEngine jmeter = new StandardJMeterEngine();
  
      // Initialize Properties, logging, locale, etc.
      JMeterUtils.loadJMeterProperties("C:\\apache-jmeter-2.12\\bin\\jmeter.properties");
      JMeterUtils.setJMeterHome("C:\\apache-jmeter-2.12");
      //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
      FileInputStream in = new FileInputStream("C:\\apache-jmeter-2.12\\bin\\statsTests2.jmx");
      HashTree testPlanTree = SaveService.loadTree(in);
      in.close();
  
      // Run JMeter Test
      jmeter.configure(testPlanTree);
      jmeter.run();
  }
  </code></pre>