title: Environment variables, JAR and batch files
body: <p>I have a quick question.
  I'm trying to run a JAR file that gets data from environment variables.
  If I open a CMD window and set each environment variable manually using the <code>set</code> command  and then run the JAR file with <code>java -jar MyFile.jar</code> everything works.<br>
  However, when I create a batch file containing the exact commands I executed before, the JAR file doesn't find the environment variables. I tried using <code>cmd /k</code> after all of the commands to try and access the environment variables with <code>echo</code> and they work. Can anyone tell me what am I doing wrong here? Thank you.<br>
  Edit:<br>
  Here's my batch file:  </p>
  
  <pre><code>SET ATR1=ATR1_VALUE  
  SET ATR2=ATR2_VALUE  
  SET ATR3=ATR3_VALUE  
  JAVA -JAR MyFile.jar
  </code></pre>
  
  <p>Using this file my JAR doesn't access the environment variables successfully.<br>
  However if I run each line on it's own the JAR file works.<br>
  I'm using <code>System.getenv()</code> to access the environment variables in my code.<br>
  I've tried using <code>setx</code> but it didn't change anything.</p>