Java examples for File Path IO:Path
Combining paths using path resolution
import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path rootPath = Paths.get("/home/docs"); Path partialPath = Paths.get("users.txt"); Path resolvedPath = rootPath.resolve(partialPath); System.out.println("rootPath: " + rootPath); System.out.println("partialPath: " + partialPath); System.out.println("resolvedPath: " + resolvedPath); System.out.println("Resolved absolute path: " + resolvedPath.toAbsolutePath()); }/* ww w . j a v a 2 s . c o m*/ }