Here you can find the source of newURL(String location)
public static URL newURL(String location) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.URI; import java.net.URL; public class Main { public static URL newURL(String location) throws IOException { return newURI(location).toURL(); }//from w ww . jav a2 s. co m public static URI newURI(String location) throws IOException { try { return URI.create(location); } catch (IllegalArgumentException e) { throw new IOException("malformed uri: " + location, e); } } }