Create a tool that can assemble and optimize a set of modules and their dependencies into a custom run-time image as defined in JEP 220.
This JEP does not commit the resulting tool to generate anything other than a modular run-time image.
It is not a goal of this JEP to define a standard or supported API for plugins. Instead, the plugin API will be strictly experimental. A future JEP may re-visit this topic once experience has been obtained using the plugin API defined by this JEP.
JEP 261 defines link time as an
optional phase between the phases of compile time (the
and run-time (the
java run-time launcher). Link time requires a linking
tool that will assemble and optimize a set of modules and their
transitive dependencies to create a run-time image or executable.
Link time is an opportunity to do whole-world optimizations that are otherwise difficult at compile time or costly at run-time. An example would be to optimize a computation when all its inputs become constant (i.e., not unknown). A follow-up optimization would be to remove code that is no longer reachable.
A basic invocation of the linker tool,
$ jlink --module-path <modulepath> --add-modules <modules> --limit-modules <modules> --output <path>
--module-pathis the path where observable modules will be discovered by the linker; these can be modular JAR files, JMOD files, or exploded modules
--add-modulesnames the modules to add to the run-time image; these modules can, via transitive dependencies, cause additional modules to be added
--limit-moduleslimits the universe of observable modules
--outputis the directory that will contain the resulting run-time image
--limit-modules options are
described in further detail in JEP 261.
Other options that
jlink will support include:
--helpto print a usage/help message
--versionto print version information
The alternative to a linking tool is to use platform-specific JDK and JRE image-build scripts. This approach would make it difficult to create custom run-time images.
Beyond the expected set of unit tests to exercise the tool I, the JDK build
will regularly exercise
jlink by creating the JDK and JRE run-time images.
Risks and Assumptions
The set of requirements for the tool is not complete at this time. The tool's extensibility is expected to evolve.
This JEP depends on the module system that will be specified by JSR 376 (Java Platform Module System) and implemented by JEP 261: Module System.
The initial implementation of JEP 220 in JDK 9 uses a custom build-time tool to construct JRE and JDK images. That tool will be replaced by
- is blocked by
JDK-8061972 JEP 261: Module System
- relates to
JDK-8157991 Performance data/impact for users to determine what jlink optimization should be selected
JDK-8061971 JEP 220: Modular Run-Time Images
JDK-8080531 JEP 275: Modular Java Application Packaging