Here you can find the source of resolveFileUri(String fullPageURI, File rootPath)
public static File resolveFileUri(String fullPageURI, File rootPath)
//package com.java2s; // Released under the terms of the CPL Common Public License version 1.0. import java.io.File; import java.net.URI; public class Main { public static File resolveFileUri(String fullPageURI, File rootPath) { URI uri = URI.create(fullPageURI); try {/*from w ww. ja v a2 s. c o m*/ return new File(uri); } catch (IllegalArgumentException e) { if (!"file".equals(uri.getScheme()) || rootPath == null) { throw e; } // "URI has an authority component" (file://something) or "URI is not hierarchical" (file:something) // As a fallback, resolve as a relative URI URI rootUri = rootPath.toURI(); uri = rootUri.resolve(uri.getSchemeSpecificPart().replaceFirst("^/+", "")); return new File(uri); } } }