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
public static File getDesktopFolder() throws FileNotFoundException {
final int desktopOSType = FileManager.OSTypeToInt("desk");
final String desktopFolderName = FileManager.findFolder(desktopOSType);
return new File(desktopFolderName);
}
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 the similar Windows-oriented question here:
public static File getDesktopFolder() {
return new File(System.getProperty("user.home"), "Desktop");
}
However this seems brittle and potentially buggy in certain locales or on certain strangely-configured systems.