Java examples for File Path IO:Path
Create an absolute path
import java.net.URI; import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path path10 = Paths.get("C:/folder1/folder2/folder4", "test.txt"); Path path11 = Paths.get("C:", "folder1/folder2/folder4", "test.txt"); Path path12 = Paths.get("C:", "folder1", "folder2", "2009", "test.txt"); Path path13 = Paths.get("C:/folder1/folder2/folder3/test.txt"); Path path14 = Paths.get(System.getProperty("user.home"), "downloads", "test1.txt"); Path path15 = Paths.get(URI.create("file:///C:/folder1/folder2/folder3/test.txt")); }/*from w w w . j a va 2 s.co m*/ }