United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 5045575 need a way to determine "My Documents" directory on Windows
5045575 : need a way to determine "My Documents" directory on Windows

Details
Type:
Enhancement
Submit Date:
2004-05-11
Status:
Closed
Updated Date:
2004-05-15
Project Name:
JDK
Resolved Date:
2004-05-15
Component:
core-libs
OS:
windows_xp
Sub-Component:
java.lang
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
1.4.2
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

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")
                                     
2004-06-11
EVALUATION

Duplicate of 
4787931: System property "user.home" does not correspond to "USERPROFILE" (win) 

###@###.### 2004-05-14
                                     
2004-05-14



Hardware and Software, Engineered to Work Together