Here you can find the source of getFileFromURL(URL urlToDecode)
public static File getFileFromURL(URL urlToDecode)
//package com.java2s; /***/* w w w . ja v a 2 s .c o m*/ * Copyright (C) 2010 Johan Henriksson * This code is under the Endrov / BSD license. See www.endrov.net * for the full text and how to cite. */ import java.io.File; import java.io.UnsupportedEncodingException; import java.net.*; public class Main { /** * Work-around for a bug/faulty design in getResource().getFile(), making space %20 etc */ public static File getFileFromURL(URL urlToDecode) { try { return new File(URLDecoder.decode(urlToDecode.getFile(), "UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } } }