JDK-5045575 : need a way to determine "My Documents" directory on Windows
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-05-11
  • Updated: 2004-05-15
  • Resolved: 2004-05-15
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 05/11/2004


A DESCRIPTION OF THE REQUEST :
I sincerely hope that I am missing something, but as far as I know, there is no reasonable way to determine the location of the user's "My Documents" directory when running on a Windows system.

On every other platform, the "user.home" system property is a sensible, sane location in which to store documents.  Under Windows, it is not.  However, many Java programs, having been written on non-Windows platforms, store their documents in "user.home" by default.

Further, even if a programmer is aware of this and tries to figure out the location of the "My Documents" on Windows, I am aware of no reasonable way to do it.  The obvious solution is to provide a "user.documents" system property -- this could be the same as "user.home" on non-Windows platforms, but point the "My Documents" on Windows.

JUSTIFICATION :
Without this feature, there is no (sane) way to determine a reasonable default document location under Windows.


CUSTOMER SUBMITTED WORKAROUND :
Use ShellFolder to get access to it
(Incident Review ID: 265050) 
======================================================================

Comments
WORK AROUND Use System.getenv("HOMEDRIVE") combined with getenv("HOMEPATH"), or alternatively, System.getenv("USERPROFILE")
11-06-2004

EVALUATION Duplicate of 4787931: System property "user.home" does not correspond to "USERPROFILE" (win) ###@###.### 2004-05-14
14-05-2004