Java examples for File Path IO:Path
Locating Files and Directories Using Paths
import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path rootPath = Paths.get("/home/music/"); Path resolvedPath = rootPath.resolve("tmp/Robot Brain A.mp3"); System.out.println("rootPath: " + rootPath); System.out.println("resolvedPath: " + resolvedPath); System.out.println();/*from w w w . j a v a 2 s .c om*/ resolvedPath = rootPath.resolveSibling("tmp/Robot Brain A.mp3"); System.out.println("rootPath: " + rootPath); System.out.println("resolvedPath: " + resolvedPath); } }