Newsletter:

(Source Code) Static function to get current working directory

Source Code : Static function to get current working directory

The following static function can be used to get the current working director.

Code:

private static void doGetDir() {

    String curDir = System.getProperty("user.dir");
    
    System.out.println("\nThe current working directory is:");
    System.out.println(" - " + curDir);
}

Courtesy:- Java-forums.org