Multi-Release JAR runtime support
Hervé BOUTEMY
herve.boutemy at free.fr
Tue Apr 19 01:49:45 UTC 2016
Hi OpenJDK Core Developers,
Today, to prepare a conference talk on Java 9 (DevoxxFR, on wednesday 20th), I
tested once again Maven proposed layout to produce Multi-Release JARs:
https://github.com/hboutemy/maven-jep238
And I added a little script (. run-demo.sh) to run the build then execute the
resulting jar with JRE 7, 8 and 9.
As expected, JRE 7 and 8 gave the same result, since my JRE 8 isn't patched to
support MR JARs (if there is a simple way to add support, don't hesitate to
give me a pointer. Or if there is any standard Java 8 build that should
support it).
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?
Regards,
Hervé
Here is the interesting part of the output of the script:
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/8/mr/A.class OK
testing: META-INF/versions/9/mr/A.class OK
No errors detected in compressed data of multirelease/target/multirelease-0.8-
SNAPSHOT.jar.
[...]
# 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
BASE
# 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
BASE
More information about the core-libs-dev
mailing list