Convert URI to URL
import java.net.URI; import java.net.URISyntaxException; import java.net.URL; public class Main { public static void main(String[] args) { URI uri = null; URL url = null; String uriString = "http://www.google.com/"; try { uri = new URI(uriString); } catch (URISyntaxException e) { e.printStackTrace(); } System.out.println("Original URI : " + uri); } }