JDK-8024029 : Need a method to query app data directory
  • Type: Enhancement
  • Component: other-libs
  • Sub-Component: other
  • Priority: P2
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2013-08-30
  • Updated: 2016-02-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorUnresolved
Related Reports
Relates :  
Relates :  
Description
Applications may want to store some configuration data in the user profile. Often there are standard locations for storing such data, e.g.:

* *NIX:    $HOME/.<app_name>
* Mac:    $HOME/Library/Application Support/<app_name>
* Windows:    %HOME%\AppData\Roaming\<app_name>

where the <app_name> represents an app-defined name of the application.

This is a request to introduce something like the following in JDK:

   public static Path java.nio.file.Files.getAppDataPath(String appName);

that would return a Path object pointing to a directory where the app may store its data. The directory may not exist yet, and it is the responsibility of the app (not JDK) to create it if needed.

Note: in the future we may want to handle the Roaming vs. Local cases (either with a boolean argument for this method, or as a separate API call). However, currently this isn't a requirement.

This API is requested by JavaFX Web component. See https://javafx-jira.kenai.com/browse/RT-31920 and https://javafx-jira.kenai.com/browse/RT-31249 for more information. As a temporary solution we have implemented this functionality in FX native library Glass so that we can use it in JDK/FX 8. But since this API doesn't belong to a GUI toolkit, we would like to see this API implemented in core JDK instead.

It would be perfect to add this API in JDK 8 if possible. However, JDK 9 should work good for us as well.
Comments
A few additional notes: 1. java.nio.file.Files was just an example. We're OK if this API is added to any other class. 2. FX would probably be OK with a com.sun.* API for this feature in case a public API is considered unfeasible. However, we do need to move this functionality from FX to JDK in one form or another in any case, because it simply doesn't belong to FX.
30-08-2013