Here you can find the source of relativize(Path absoluteDirectory, Path subDirectory)
public static Path relativize(Path absoluteDirectory, Path subDirectory)
//package com.java2s; //License from project: Open Source License import java.nio.file.Path; public class Main { public static Path relativize(Path absoluteDirectory, Path subDirectory) { return absoluteDirectory.relativize(subDirectory.toAbsolutePath().normalize()); }/*from w ww . ja v a 2 s. c o m*/ }