title: How to get the Desktop path in Java 9 on Mac
body: <p>Java 9 prevents direct use of com.apple.eio.FileManager. Until now I've used this on Mac to get the location of the user's "Desktop" path, as follows</p>
  
  <pre><code>public static File getDesktopFolder() throws FileNotFoundException {
      final int desktopOSType = FileManager.OSTypeToInt("desk");
      final String desktopFolderName = FileManager.findFolder(desktopOSType);
      return new File(desktopFolderName);
  }
  </code></pre>
  
  <p>Is there a replacement in Java 9 for using com.apple.eio.FileManager to find the Desktop? My temporary solution is to use the answer to <a href="https://stackoverflow.com/questions/1080634/how-to-get-the-desktop-path-in-java">the similar Windows-oriented question here</a>:</p>
  
  <pre><code>public static File getDesktopFolder() {
      return new File(System.getProperty("user.home"), "Desktop");
  }
  </code></pre>
  
  <p>However this seems brittle and potentially buggy in certain locales or on certain strangely-configured systems.</p>