Java Example - View Current Working Directory
The following example demonstrates using the System's getProperty() method to get the current working directory:
Main.java file
class Main {
public static void main(String[] args) {
String curDir = System.getProperty("user.dir");
System.out.println("Your current working directory is:" + curDir);
}
}
The output of running the above code is:
你当前的工作目录为 :/www/javaOther Extensions
Java Example