Get user home directory name in Java
Description
The following code shows how to get user home directory name.
Example
//from ww w.j a v a2 s .c om
public class Main {
public static void main(String[] args) {
String userHome = "user.home";
String path = System.getProperty(userHome);
System.out.println("Your Home Path: " + path);
}
}
The code above generates the following result.