Here you can find the source of resolveUri(URI baseUri, String resourceUriStr)
public static URI resolveUri(URI baseUri, String resourceUriStr) throws URISyntaxException, MalformedURLException
//package com.java2s; //License from project: Common Public License import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; public class Main { public static URI resolveUri(URI baseUri, String resourceUriStr) throws URISyntaxException, MalformedURLException { URI targetUri = null;//from w w w. ja v a 2 s . co m if (baseUri.toString().startsWith("jar:")) { URI temp = new URI(resourceUriStr); if (temp.isAbsolute()) { targetUri = temp; } else { URL targetUrl = new URL(baseUri.toURL(), resourceUriStr); targetUri = targetUrl.toURI(); } } else { targetUri = baseUri.resolve(resourceUriStr); } return targetUri; } }