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
|
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 |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Find User Home Directory View All Comments
Post your Comment