JDK-6519127 : Vista: user.home property not set correctly
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P4
  • Affected Version: 6
  • OS: windows_vista
  • CPU: x86
  • Submit Date: 2007-01-30
  • Updated Date: 2014-03-27
  • Resolved Date: 2013-01-23
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 8
8 b75Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6000]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Corporate computer part of a Windws NT domain.

A DESCRIPTION OF THE PROBLEM :
The system property user.home is wrong. If my login name is xxxx, the user.home directory should be c:\Users\xxxx on Vista. Java gets the user.name right, but the user.home is different: in my case it uses the domain guest account, which I have no clue how it gets to that! It might just be that it is the first directory found in C:\Users.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1.6.0
xxxx
C:\Users\xxxx

ACTUAL -
1.6.0
xxxx
C:\Users\DGUEST

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class TestUserHome {
  public static void main(String[] args) {
    System.out.println(System.getProperty("java.version"));
    System.out.println(System.getProperty("user.name"));
    System.out.println(System.getProperty("user.home"));
  }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Force the user.home system property to the correct as a -Duser.home=... argument to the JVM.

Comments
Release note added to "Incompatibilities between JDK 8 and JDK 7" section of the JDK 8 release notes
2014-03-27

EVALUATION On a "fresh' installed Vista, the lookup mechansim just works fine (means your DESKTOP fold is under your "home" directory, which is the "normal" scenario). Thing goes wrong in cases you "tweak" the DESKTOP folder or as one reported when updated from XP2 and somehow the Windows register still remembers the "old" location of DESKTOP folder. The suggested approach of taking a look at USERPROFILE might be a solution, but might be too risky, consider someone just re-set that env to somewhere else....
2008-08-28

EVALUATION Currently we are looking at the registry key "DeskTop" in entry "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" for HKEY_CURRENT_USER, kind of hacky. Will check the config of a vista when I have one installed.
2007-01-31