We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
import java.net.URL;
public class ResolveRelativeURL {
public static void main (String[] args) throws
java.net.MalformedURLException {
URL relativeURL, baseURL;
baseURL = new URL ("http://www.rgagnon.com/");
relativeURL = new URL ( baseURL, "./javadetails/java-0001.html");
System.out.println ( relativeURL.toExternalForm ());
/*
output :
http://www.rgagnon.com/javadetails/java-0001.html
*/
}
}