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

前端 未结 2 1699
忘了有多久
忘了有多久 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:19

    In windows it gets it like stated in the accepted answer, and is dependent of the Desktop folder location.

    There is workaround if you want to change your default Desktop folder location, and still want to have user.home in the same folder:

    add this into the environment variables:
    _JAVA_OPTIONS:-Duser.home=%HOMEDRIVE%%HOMEPATH%

    or in command line:
    set _JAVA_OPTIONS=-Duser.home=%HOMEDRIVE%%HOMEPATH%

    I saw the solution in the comments of this page: http://www.timehat.com/javas-user-home-is-wrong-on-windows/

提交回复
热议问题