How to trim some more fat OpenJDK 8

David Holmes david.holmes at
Thu Feb 27 04:45:00 UTC 2014

Hi Medi,

First note that a JDK and a JRE are two different things. A JDK contains 
a JRE plus it has development tools like javac, javap etc. So the jre 
subdirectory contains everything in the JRE; and everything above that 
is for the JDK. So to minimize things you might want a JRE not a JDK: 
build "images" target -> images/j2re-image vs. images/j2sd-image

You control whether debuginfo files are generated, and whether if 
present they become zipped (.diz files) using the configure arguments:

but note that non-product builds will always generate debug symbols as 
that is their primary purpose.

You can also save space by only building one VM eg:

--with-jvm-variants=client  (or server if you prefer)

Note sure what --disable-headful will actually save you, but if you 
don't care about GUI then you can also look at building the compact 
profiles (make target "profiles" -> images/j2re-compact[123]-image) 
which produce even smaller JRE's. Compact profiles are only supported on 

Note that the build will typically build everything but the resulting 
images only have a subset of what is built.


On 27/02/2014 1:22 PM, Medi Montaseri wrote:
> Hi,
> I am building OpenJDK 8 for a tight environment and would like to have a very small JDK (or I should say JRE) footprint....sort of like headless but even more.
> I would like to do this from the configure(1) as much as possible. And then resort to rm(1).
> Here is build result on amd64 Debian 7.3 without any trimming
> mmontaseri at griffin:~/work/bug-91383/openjdk8> du -sh *
> 168K    bin                           # these are all symlinks to jvm/bin
> 269M    jvm
> too much...I need to get down to under 30 Meg. So I build again with
> configure --disable-headful --disable-debug-symbols --disable-zip-debug-info
> and I get the following result
> mmontaseri at griffin:~/work/bug-91383/depot2> du -sh *
> 168K    bin
> 168M    jvm                   # went down from 296M to 168M
> That is good, but not good enough....I then looked around and found about 66 Meg of *.diz files. We don't need these.
> Q1- is there any configure option to not produce *.diz files (gdb debug info for .so files). If not, then I have to rm(1) them.
> Q2- I see two lib directories under jvm/openjdk-1.8.0-internal
> mmontaseri at griffin:~/work/bug-91383/depot2/jvm/openjdk-1.8.0-internal> du -sh jre/*
> 272K    jre/bin
> 97M     jre/lib
> 20K     jre/LICENSE
> mmontaseri at griffin:~/work/bug-91383/depot2/jvm/openjdk-1.8.0-internal> du -sh lib
> 38M     lib
> Can you help me understand the difference between lib/* and jre/lib
> I see debian has created a set of packages on OpenJDK 7, like so
> ii  openjdk-7-jdk:amd64                           7u25-2.3.10-1~deb7u1                    amd64        OpenJDK Development Kit (JDK)
> ii  openjdk-7-jre:amd64                           7u25-2.3.10-1~deb7u1                     amd64        OpenJDK Java runtime, using Hotspot JIT
> ii  openjdk-7-jre-headless:amd64                  7u25-2.3.10-1~deb7u1                amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
> ii  openjdk-7-jre-lib                             7u25-2.3.10-1~deb7u1                           all              OpenJDK Java runtime (architecture independent libraries)
> thanks
> Medi

More information about the build-dev mailing list