title: System.getenv() returns null when super user
body: <p>If I run <code>echo $XDG_CURRENT_DESKTOP</code> and <code>sudo echo $XDG_CURRENT_DESKTOP</code> in Ubuntu, I get <code>Unity</code> in both cases. If I in Java write <code>System.getenv("XDG_CURRENT_DESKTOP")</code>, it returns <code>Unity</code> when I run the program without super user privileges but it returns <code>null</code> when I run it with <code>sudo</code>. What is going on here?</p>
  
  <pre><code>public class GetEnv {
          public static void main(String[] args) {
                  System.out.println(System.getenv("XDG_CURRENT_DESKTOP"));
          }
  }
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>$ echo $XDG_CURRENT_DESKTOP
  $ Unity
  $ sudo echo $XDG_CURRENT_DESKTOP
  $ Unity
  $ javac GetEnv.java
  $ java GetEnv
  $ Unity
  $ sudo java GetEnv
  $ null
  </code></pre>