Java get User Home
In this section, you will study how to get the user home. We are providing you an example which will obtain the home directory by using the System.getProperty(). This will provide all the properties of the system.
System.getProperty("user.home")- This method retrieve the user's home directory of the particular system from all the properties of Windows.
Understand with Example
In this section we want to describe a code that helps you to get the home directory of the System. For this we create a class name GetUserHome;Inside this class we have main static method , declare a string variable" user home" that is used to store the properties of the system provided by using the get Property( ) of System class. The System.out.println is used to display the user's home directory of the specified system from all the properties of windows on the execution of given below code.
Here is the code of GetUserHome.java
Output will be displayed as: