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



Home Java Beginners Find User Home Directory

 
 

Share on Google+Share on Google+

Find User Home Directory

Advertisement
This section provides you an example that finds user home directory.

Find User Home Directory 

     

In this example we are find user home directory.

We are using System class  to get the information about system. System class extends Object class. System class allow us to get or set system information.

The method used into this example:

getProperty(String Key):
This method is used to get the property of system for passing Key values.

In this example we are passing "user.home" as key to get the user define home directory.

The code of the program is given below:

public class UserHomeExample 
{
  public static void main(String[] args)
  {
 
  System.out.println("User Home Path: "+
System.getProperty
("user.home"));
  }
}

The output of the program is given below:

C:\convert\rajesh\completed>javac UserHomeExample.java
C:\convert\rajesh\completed>java UserHomeExample
User Home Path: C:\Documents and Settings\Administrator

Download this example.

Advertisement

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 29, 2007

Related Tutorials

Discuss: Find User Home Directory   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com