Multi-Release JAR runtime support

Hervé BOUTEMY herve.boutemy at free.fr
Tue Apr 19 19:37:41 UTC 2016


that's it: I added this Multi-Release: true attribute configuration in the 
demo and now it works like a charm, thank you

Perhaps this requirement should be described in 
http://openjdk.java.net/jeps/238

Is it expected to be supported with JDK 8 also? Is there any magic trick to 
add this feature to a normal JDK 8?

Regards,

Hervé

FYI, here is the output now:

Archive:  multirelease/target/multirelease-0.8-SNAPSHOT.jar
    testing: META-INF/MANIFEST.MF     OK
    testing: base/Base.class          OK
    testing: mr/A.class               OK
    testing: META-INF/versions/9/mr/A.class   OK
    testing: META-INF/versions/8/mr/A.class   OK
No errors detected in compressed data of multirelease/target/multirelease-0.8-
SNAPSHOT.jar.
$ unzip -p multirelease/target/multirelease-0.8-SNAPSHOT.jar META-
INF/MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.3.9
Built-By: herve
Build-Jdk: 9-ea
Multi-Release: true

[...]

# Run Multi Release JAR with JRE 7
$ java -classpath multirelease/target/multirelease-0.8-SNAPSHOT.jar base.Base
1.7.0_71-b14
BASE

# Run Multi Release JAR with JRE 8
$ java -classpath multirelease/target/multirelease-0.8-SNAPSHOT.jar base.Base
1.8.0_25-b17
BASE

# Run Multi Release JAR with JRE 9 classic
$ java -classpath multirelease/target/multirelease-0.8-SNAPSHOT.jar base.Base
9-ea+114
FROM BASE -> NINE

# Run Multi Release JAR with JRE 9 Jigsaw
$ java -classpath multirelease/target/multirelease-0.8-SNAPSHOT.jar base.Base
9-ea+114-2016-04-15-162029.javare.4859.nc
FROM BASE -> NINE



Le mardi 19 avril 2016 08:46:36 Alan Bateman a écrit :
> On 19/04/2016 02:49, Hervé BOUTEMY wrote:
> > But the unexpected part is that JRE 9, either classical or jigsaw, don't
> > take advantage of the MR JAR: is this really expected, or did I do
> > something wrong?
> Hervé - can you dump the manifest? It's not clear from your mail that it
> has the Multi-Release attribute.
> 
> -Alan




More information about the core-libs-dev mailing list