jlink / jmods version compatibiltiy
mandy chung
2018-06-01 22:58:09 UTC
I am not sure what the Policy for backward/Forward compatibility for
JMOD files is, but when I use JDK-9.0.4 jlink on 11ea JMODs I get a
IllegalArgumentException and „error reading“ by JDK-10.0.1 with no
further Details.
jlink only supports linking modules of the same runtime version
as jlink because jlink has a few plugins such as system-modules
and generate-jli-classes that are deeply tied with java.base.
It can be enhanced in the future in particular for plugins to
support version <= jlink version.

See JDK-8185130 that was integrated in JDK 10. jlink linking with
older version of JMODS outputs a clear error message:

$ jdk11/bin/jlink --module-path jdk10/jmods --output test-image
--add-modules java.base
Error: jlink version 11.0 does not match target java.base version 10.0
If the JMOD files require newer jlink, should they have a Version
identifier to allow rejecting this. Or is it expected to normally
Error reading module: jdk-11-oraopenjdk\jmods\java.base.jmod
JDK 10 jlink does not support class file version 55 when linking
with JDK 11 modules. I agree the error message should be improved.

I created https://bugs.openjdk.java.net/browse/JDK-8204256.


Continue reading on narkive: