On Windows 7, how does Java JVM set “user.home” System property?

前端 未结 2 1702
忘了有多久
忘了有多久 2020-12-05 11:26

I am using JRE 1.7 and I discovered the user.home System property is very unusual. How does the JVM set this value?

2条回答
  •  死守一世寂寞
    2020-12-05 12:10

    This Java bug explains how: http://bugs.sun.com/view_bug.do?bug_id=4787931

    System property user.home is set by:

    1. Read the registry value for key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop
    2. Take the parent path of this value, but do not resolve environment variables.

    Example: %userprofile%\Desktop => %userprofile% (unresolved environment variable)

    This issue should be fixed in Java 8.

    Related Ref: Java user.home is being set to %userprofile% and not being resolved

提交回复
热议问题