File currentDirectory = new File(new File(".").getAbsolutePath());
System.out.println(currentDirectory.getCanonicalPath());
System.out.println(currentDirectory.getAbsolutePath());
Prints something like:
/path/to/current/directory
/path/to/current/directory/.
Note that File.getCanonicalPath()
throws a checked IOException but it will remove things like ../../../