title: What is the best way to find the user's home directory in Java?
body: <p>What is the best way to find the user's home directory in Java?</p>
  <p>The difficulty is that the solution should be cross-platform; it should work on Windows 2000, XP, Vista, OS X, Linux, and other Unix variants. I am looking for a snippet of code that can accomplish this for all platforms, and a way to detect the platform.</p>
  <p>Per Java bug <a href="https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4787931" rel="noreferrer">4787931</a>, system property <code>user.home</code> does not work correctly on Windows XP, so using this system property is not an acceptable solution as it is not cross-platform.</p>