Get Desktop directory OS-independent
问题 Of course I could use File desktop = new File(System.getProperty("user.home") + "/Desktop")); but this would only work OS-independent if the OS is set to English locale... On Windows the Desktop is named Desktop in every language it was translated to, but e.g. on Ubuntu the Desktop name gets translated (On my German system it's Arbeitsfläche ). So I'm looking for an OS- and Locale-independent way of getting a File object representing the desktop directory. 来源: https://stackoverflow.com