URI (final File zipFile, String relPath) { final String p = FileUtilRt.toSystemIndependentName(zipFile.getPath()); final StringBuilder buf = new StringBuilder(p.length() + relPath.length() + 5); if (!p.startsWith("/")) { buf.append("///"); } else if (!p.startsWith("//")) { buf.append("//"); } buf.append(p).append(relPath.startsWith("/") ? "!" : "!/").append(relPath); try { return new URI("jar", null, buf.toString(), null); } catch (URISyntaxException e) { throw new Error("Cannot create URI " + buf, e); } }