title: System environment variables in Jetty application
body: <p>How to configure system environment variables inside one Jetty application?</p>
  
  <p>e.g. For database connection details, putting it in file and checking it into cvs is bad idea. For that reason using system environment is one way to go. While the system environment variables are defined in <code>/etc/environments</code> file or <code>.bashrc/.zshrc</code> file , in Jetty application, doing <code>System.getenv("variable_name")</code> won't give anything. It will result in null.</p>
  
  <p>I have read this question: <a href="https://stackoverflow.com/questions/27157904/configuring-a-jetty-application-with-env-variables">Configuring a Jetty application with env variables</a> which concludes that which tells that Jetty doesn't support <code>System.getenv()</code> and not even in <code>start.ini</code> file.</p>
  
  <p>And <a href="https://stackoverflow.com/questions/15884105/jetty-and-etc-environment-on-ubuntu-12-10">jetty and etc environment on ubuntu 12.10</a> which says <code>In the jetty.sh script you can source the /etc/environment file and they will be present.</code> which I tried and didn't get the values as expected meaning it gave me only null.</p>
  
  <p>If I can't use the default <code>System.getenv()</code> or in any <code>.ini</code> file then how to specify credentials such as Database connection etc ? </p>