Get absolute path in Java
Description
The following code shows how to get absolute path.
Example
import java.nio.file.Path;
import java.nio.file.Paths;
//w w w . ja v a2 s . c om
public class Main {
public static void main(String[] args) throws Exception {
Path path = Paths.get("users.txt");
System.out.println("Absolute path: " + path.toAbsolutePath());
}
}
The code above generates the following result.