how to split up runtime / development parts in OpenJDK 11?

Erik Joelsson erik.joelsson at
Mon Jul 9 18:39:17 UTC 2018

On 2018-07-09 10:54, Fridrich Strba wrote:
> Alan,
> On 07/07/18 21:41, Alan Bateman wrote:
>> JEP 220 was integrated in 2014 for JDK 9 so I'm puzzled as to why this
>> is only coming up now. Did you do this splitting with JDK 9 and JDK 10?
>> I can't see how this could have worked without either re-running jlink
>> or else having your "jre" image including the classes/resources for all
>> modules that are in the "jdk" image.
What I think Alan refers to here is that all the class files are 
packaged in lib/modules with link time meta data generated based on the 
complete set of modules included. You simply cannot split that file 
without rerunning jlink. You could still filter out the headers, some 
launchers and native libraries from the image, but best case that is 
just going to be cosmetic. Worst case you eventually get into trouble 
with some application missing those libraries, which the linked image is 
claiming to be present. You get a discrepancy between what "java 
--list-modules" says and what can actually be used.

If your concern is size, then the big ticket items that should be safe 
to remove for a smaller footprint JRE replacement would be and 
the jmods. A few launchers and native libraries are not going to put a 
big enough dent in the overall size of the image considering the 
potential risk. If you are really concerned with size, then you need to 
link your JRE as a separate image using size reducing options (like 
legacy-jre-image does, with --no-man-pages --no-header-files --strip-debug).

For the above reasons, I would certainly advice against using the 
legacy-jre-image as a template for pruning the JDK image.

AFAIK, removing the headful awt library is still OK for a headless 
installation though.

> I don't think that he speaks about putting a jre in a separate directory
> whatsoever. What we normally do in Linux distributions, is separate the
> installation into runtime packages and devel packages. So that people
> that only use java applications, but never build them, don't have to
> install any of the JDK tools. In SUSE, we even split the headless
> runtime bits from those that need XWindows system. For the same reason
> as not to pull any X dependencies by installing only a jre that will be
> used in headless context.
> Now, since JEP 220, there is nothing like jre subdirectory and that is
> just fine. We are installing those packages in the same prefix. In SUSE,
> we did not bother about the jre images too much besides one use-case.
> When I built the OpenJDK, I looked into the files in the jre image just
> to know which files in the jdk image that I distribute could be
> considered the jre files. This simplified my task in determining the
> split. With the disappering of the jre image, there is no way now to
> know what was considered by Oracle as jre files and what was condidered
> as jdk-only files.
> At least, this is how I understood the discussion. I might be utterly
> wrong, as my wife could witness. So, if I did not get things right,
> please, correct me.
> Fridrich

More information about the distro-pkg-dev mailing list