Using the Operating System's Underlying zlib Library
The zlib library is a critical component of the JDK responsible for all
the data compression operations exposed by the JDK APIs, primarily via
the java.util.zip API. Maintained by a separate project, the zlib
libraries are updated in the JDK source base when necessary.
There is a build time option in the JDK to specify whether the OS zlib
library (system) or the zlib library that ships in the JDK sources
(bundled) should be used by the JDK at runtime. Currently, the Linux OS
and macOS-x64 OSes (and Solaris OS on JDK 11) use the system option.
This allows the JDK to utilize customized zlib libraries (if present) on
those Unix platforms. This has been the case since JDK 9, as detailed in
the release
notes.
At time of writing, the JDK ships zlib v1.3.1 in the main JDK feature line (see JDK-8324632 Update Zlib Data Compression Library to Version 1.3.1).
This is a JDK build time configuration; there are no runtime options to control such a configuration.
When building the JDK you can use the configure argument --with-zlib
to select the zlib library desired:
- The OS’s library:
--with-zlib=system - The library bundled with the JDK:
--with-zlib=bundled
Last reviewed on Sat Feb 01 2025 00:00:00 GMT+0000 (Coordinated Universal Time)