Is there a way to get user's home directory from java code?
For example: my user's home directory absolute path is C:\Users\stanislav. If I type %HOMEPATH% in Windows file explorer it will open me my user's directory.
I want to get this directory as File from JAVA using this code:
final Path homePath = Path.of("%HOMEPATH%");
final File file = homePath.toFile();
file.exists() // returns false
But this path is not referred to any file or directory. Help please.