Here you can find the source of relativize(URI basePath, File path)
private static String relativize(URI basePath, File path)
//package com.java2s; //License from project: Apache License import java.io.File; import java.net.URI; public class Main { /** Create path relative to base path */ private static String relativize(URI basePath, File path) { return (basePath != null) ? basePath.relativize(path.toURI()) .getPath() : path.getPath(); }/*from w w w .ja v a 2 s. co m*/ }