title: Getting environment variable value in java
body: <p>An environment variable has been set in windows machine (windows 7) and trying to get the value of the variable from the following java code. However, it returns a null value.</p>
  
  <pre><code>final String value = System.getenv("PE_CONF_PWD");
  System.out.println(value);
  //print null
  </code></pre>
  
  <p>Now if I execute the following code, it throws a security exception that means that the user does not have the variable.</p>
  
  <pre><code>SecurityManager m = new SecurityManager();
  m.checkPropertyAccess("PE_CONF_PWD");
  // java.security.AccessControlException: access denied ("java.util.PropertyPermission" "PE_CONF_PWD" "read") 
  </code></pre>
  
  <p>Later I have added permission in the JRE security policy file and add the following entry but still it returns null value.</p>
  
  <pre><code>permission java.lang.RuntimePermission "getenv.PE_CONF_PWD";
  </code></pre>