private File findSource(URL location) throws IOException { URLConnection connection = location.openConnection(); if (connection instanceof JarURLConnection) { return getRootJarFile(((JarURLConnection) connection).getJarFile()); } return new File(location.getPath()); }