A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/javaexamples/dir_current.htm below:

How to find current working directory in Java

How to find current working directory in Java Problem Description

How to find current working directory?

Solution

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

public 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

java_directories.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4