title: In java under Windows, how do I find a redirected Desktop folder?
body: <p>I know using .NET languages such as C#, one can do something like</p>
  
  <pre><code>Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
  </code></pre>
  
  <p>to find the redirected location of the Desktop.  However, under Java, I cannot think of a good way to do this.  What is the most appropriate way to find a redirected user Desktop directory from Java, without using JNI?  The specific purpose here is for the purposes of managing a desktop shortcut, if the user wants one, for a Java Web Start application.</p>
  
  <p>This application needs to write to the "Application Data" tree as well as optionally to the Desktop.  I am making the assumption that <code>%APPDATA%</code> is always correctly populated, even when folders are redirected, for finding the "Application Data" tree.  So my open question is how to reliably find the Desktop folder.</p>
  
  <p>NOTE:  I believe that the Java system property <code>${user.home}</code> actually (<a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4787931" rel="noreferrer">and erroneously</a>) locates the user's Desktop directory via registry keys and then tries to navigate up one directory to find the "home" directory.  This works fine when no directories are redirected, and otherwise may or may not return something useful.</p>