JEP 238: Multi-Version JAR Files

Paul Sandoz paul.sandoz at oracle.com
Wed Feb 25 13:49:11 UTC 2015


HI Peter,

On Feb 14, 2015, at 3:56 PM, Peter Levart <peter.levart at gmail.com> wrote:
> 
> Hi Paul,
> 
> I read through the proposal and couldn't find an explanation of how resources placed in versioned paths are going to be visible. For example, if the multi-versioned jar contains the following structure:
> 
> my.properties
> META-INF/versions/8/my.properties
> META-INF/versions/9/my.properties
> 
> 
> What will the following code return, when run on JDK9:
> 
> URL[] urls = ClassLoader.getSystemClassLoader().getResources("my.properties");
> 
> Will we only get 1 URL: META-INF/versions/9/my.properties
> or 3 URLs in order: META-INF/versions/9/my.properties, META-INF/versions/8/my.properties, my.properties
> 
> Class name -> .class file resolving is easy, since only the 1st one is used, but there can be multiple general resources for same path.
> 

The intension is only one such "my.properties" resource file will be found within the MVJAR. There may be some subtleties when using absolute names.  The analogy of placing things on the classpath in the appropriate order does break down in this respect.

Paul.



More information about the core-libs-dev mailing list