title: Using environment variables in "VM options" and "Program arguments"
body: <p>In my project configuration in IDEA, I have the following text fields:</p>
  
  <p><img src="https://i.stack.imgur.com/kD4ig.png" alt="Project configuration"></p>
  
  <p>I would like to define some environment variables, and refer to them in the fields <code>"VM options"</code> and <code>"Program arguments"</code>. </p>
  
  <p>I tried with the following definitions for environment variables:</p>
  
  <pre><code>MY_FOLDER=/some/random/path
  MY_ARGUMENT=2
  </code></pre>
  
  <p>and then in <code>"VM options"</code> I entered:</p>
  
  <p>-<code>Dfoo=$MY_FOLDER</code></p>
  
  <p>and in program arguments I entered</p>
  
  <pre><code>$MY_ARGUMENT foo bar
  </code></pre>
  
  <p>However, the environment variables <strong>do not seem to be resolved</strong> prior to calling my class, i.e. if I inspect <code>args[0]</code> in Java, it holds the string value <code>$MY_ARGUMENT</code>,  <strong>not</strong>  <code>2</code>.</p>
  
  <p>Why? and how can I fix this?</p>