title: TOMCAT_OPTS, environment variable and System.getEnv()
body: <p>I use tomcat and I want to get an environment variable in my java code.</p>
  
  <p>To set an environment variable, I use this bash command :</p>
  
  <pre><code>export TOMCAT_OPTS=-Dmy.var=foo
  </code></pre>
  
  <p>After it I start tomcat</p>
  
  <pre><code>./startup.sh (in bin folder of tomcat)
  </code></pre>
  
  <p>In my java code, I try to get this variable :</p>
  
  <pre><code>System.getEnv("my.var")
  </code></pre>
  
  <p>But it returns NULL.</p>
  
  <p>How can I do that ?</p>
  
  <p>I precise that if I use maven to launch tomcat and use eclipse environment tab, the variable is found ! But I need to launch tomcat like above in production mode.</p>
  
  <p>EDIT: when using export MY_VAR directly it runs in local but not on my server...</p>