Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Java Java-get-example Java get User Home

Related Tutorials


Share on Google+Share on Google+

Java get User Home

In this section, you will study how to get the user home.

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

public class GetUserHome
public static void main(String args[]){
String userHome=System.getProperty("user.home");

Output will be displayed as:

Download Source Code


If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 15, 2009

Related Tutorials

Discuss: Java get User Home  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image