code: public static Path fromUrl(URL url) {
      try {
        switch (url.getProtocol()) {
          case "file":
            return Paths.get(url.toURI());
          case "jar":
            String[] parts = url.getPath().split("!", 0);
            Path jarFile = Paths.get(new URI(parts[0]).toURL().getFile());
            FileSystem fs = getJarFs(jarFile);
            return fs.getPath(parts[1].substring(1));
          default:
            throw new IllegalArgumentException("unsupported fs type for '" + url + "'");
        }
      } catch (Exception e) {
        throw new RuntimeException("Failed to resolve path from " + url, e);
      }
    }
docs: Isn't this what {@link Paths#get(URI)} should do?