Java tutorial
//package com.java2s; import java.io.File; import java.net.URI; import java.net.URL; public class Main { private static File getFile(URL url) { String dir = url.toString(); File md; try { md = new File(new URI(dir)); } catch (IllegalArgumentException e) { // this is an attempt at a crazy workaround that should not really work if (dir.startsWith("file://")) { md = new File(dir.substring(5, dir.length()).replaceAll("\\%20", " ")); } else { System.err.println("this should never happen! bad file: " + dir); md = new File("maps/"); } } catch (Exception e) { throw new RuntimeException("Cant create file: " + dir, e); } return md; } }