file.toURI().toURL() 

could be used instead