title: Java System Environment Variable
body: <p>Does Java have a default System Environment Variable that will always be read/appended when we set it? <code>CATALINA_OTPS</code>/<code>JAVA_OPTS</code> etc seems only for TOMCAT/JBOSS etc. </p>
  
  <ol>
  <li>I do not want to set it through Java system properties (which is passed in via -Dprop1=value1 -Dprop2=value2) as it involves shell/batch script. </li>
  <li>It should work across OS, like double click jar file in Windows.</li>
  <li>It should work across different JREs (Sun, IBM, OpenJDK etc).</li>
  <li>It should not involve extra coding.</li>
  <li>It should work in most libraries configuration file, like setting log4j
  level ${LOG_LEVEL}.</li>
  </ol>
  
  <p><strong><em>Update</em></strong>: Added item # 4 and 5. Remove OS from title to make my question clearer.</p>
  
  <p><strong><em>Update 2</em></strong>: After looking at Perception's answer, it seems like my item 2 and 3 can be achieved via <code>System.getenv</code>. How to achieve item 4 and 5?</p>
  
  <p>Here is example of scenario:
  Imagine now <code>JAVA_DEFAULT_OPTS</code> is an environment variable that will be read by Java as it has now become the standard. On development desktop machine, I set <code>JAVA_DEFAULT_OPTS=-DLOG_LEVEL=DEBUG -Xmx384m</code>; On production server machine, customers set <code>JAVA_DEFAULT_OPTS=-DLOG_LEVEL=INFO -Xmx1024m</code>. When I/users double click the jar file on Windows, the application will run will different log4j level and max memory heap size.</p>