How to determine the value of user.home without writing a program?

On Windows XP, is there a way to determine the current value of the Java user.home system property without needing to write an example program like this ?

i.e. from the command line or control panel or registry, etc.?

+4
source share
2 answers

If you need to find the exact value that will be returned for user.home in the java program when it is run under the same user account, you must run the java program to get the value. There is no guaranteed stable mapping to anything else in Windows for this purpose, and the currently used display is incorrect, and it is unlikely to be altered in the long run.

This error record describes how user.home actually gets this value at the moment and discusses several alternatives that might be more appropriate: http://bugs.sun.com/view_bug.do?bug_id=4787931

+5
source

To find the user's home directory without starting the Java program, you can ...

In the windows you need to see %HOMEDRIVE% and %HOMEPATH%

On Linux you can use $HOME

+2
source

Source: https://habr.com/ru/post/1390715/


All Articles