RFR: 8151542: URL resources for multi-release jar files have a #runtime fragment appended to them

Alan Bateman Alan.Bateman at oracle.com
Thu Apr 28 19:03:17 UTC 2016

On 28/04/2016 19:53, Steve Drach wrote:
> :
> Yes, and for regular jar files, that worked fine, but when we tried it with a multi-release jar we found it by passed the part of JarLoader where we open the jar file as a runtime jar, so, for example, this code fails to retrieve the correct versioned entry, returning instead the base entry.
> URL[] urls = { new URL(“jar:file:/foo/multi-release.jar!/“) };
> URLClassLoader cldr = new URLClassLoader(urls);
> Class<?> vcls = cldr.loadClass("version.Version”);
> The change just corrects the logic when working with a “jar:…..!/“ URL.
Can you double check the URLClassLoader spec?

Also I assume the URL you are want here is "file:/foo/multi-release.jar" 
as "jar:file:/foo/multi-release.jar!/" is the URL to the top-level 
directory in the JAR file.


More information about the core-libs-dev mailing list