Here you can find the source of fileToURLString(File file)
private static String fileToURLString(File file) throws MalformedURLException
//package com.java2s; //License from project: LGPL import java.io.File; import java.net.MalformedURLException; public class Main { private static String fileToURLString(File file) throws MalformedURLException { return file.toURI().toURL().toString(); }/*from w ww . j a v a 2 s .c o m*/ }