集册 Java实例教程 创建相对于当前文件夹的路径

创建相对于当前文件夹的路径

欢马劈雪     最近更新时间:2020-01-02 10:19:05

546
创建相对于当前文件夹的路径

import java.net.URI;

import java.nio.file.FileSystems;
/** 
 来自 时代Java**/

import java.nio.file.Path;

import java.nio.file.Paths;


public class Main {


    public static void main(String[] args) {


        //define a path relative to root, C:/, D:/ etc

        Path path06 = Paths.get("folder1/folder2/folder3/test.txt");

        Path path07 = Paths.get("folder1", "folder2/folder3/test.txt");/**nowjava.com - 时代Java**/

        Path path08 = FileSystems.getDefault().getPath("folder1/folder2/folder4", 
展开阅读全文