title: How to get the absolute folder location of a Jmeter .jmx project file from within itself?
body: <p>I have a Jmeter project that is executed by Maven and is able to locate external Beanshell scripts by the path <code>src/test/jmeter/external-scripts-dir/script1.bsh</code> , but when I run Jmeter directly in the GUI on my computer the relative location doesn't work and the tests cannot be ran standalone.   This forces me to run Jmeter from Maven.</p>
  
  <p>So, I have a project file located at a Maven layout location like <code>C:\files\git\projectA\src\test\jmeter\Project.jmx</code> but since I ran jmeter from its installation folder at  <code>C:\Jmeter2.12</code> ,  it cannot find the relative location of the external script I mentioned earlier.</p>
  
  <p>To solve this, all I need is to set a variable to the directory containing the .jmx  file.   Is there any possible way to do this?</p>
  
  <p>I can dynamically determine the home of Jmeter ( <code>C:\Jmeter2.12</code> ) pretty easily (using the following code) but that doesn't help me get the location of the project file.</p>
  
  <pre><code>${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer
    .getFileServer().getBaseDir();)}${__BeanShell(File.separator,)}
  </code></pre>
  
  <p>Is there something similar to the above code that would allow me to deduce the project file location?</p>