创建一个绝对路径
import java.net.URI; import java.nio.file.FileSystems; /* N o w J a v a . c o m 提 供 */ 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"),