Tutorials Point


  Java Basics Examples
  Java Tutorial
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java Examples - Find current directory


previous next AddThis Social Bookmark Button


Problem Description:

How to find current working directory?

Solution:

Following example shows how to get current directory using getProperty() method.

class Main {
   public static void main(String[] args) {
      String curDir = System.getProperty("user.dir");
      System.out.println("You currently working in :" 
      + curDir+ ": Directory");
   }
}

Result:

The above code sample will produce the following result.

You currently working in :C:\Documents and Settings\user\
My Documents\NetBeansProjects\TestApp: Directory



previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names