跳到主要内容

JEP 367: Remove the Pack200 Tools and API

Summary

Remove the pack200 and unpack200 tools, and the Pack200 API in the java.util.jar package. These tools and API were deprecated for removal in Java SE 11 with the express intent to remove them in a future release.

Motivation

Pack200 is a compression scheme for JAR files, introduced in Java SE 5.0 by JSR 200. Its goal is "to decrease disk and bandwidth requirements for Java application packaging, transmission, and delivery." Developers use a pair of tools -- pack200 and unpack200 -- to compress and uncompress their JAR files. An API is available in the java.util.jar package.

There are three reasons to remove Pack200:

  1. Historically, slow downloads of the JDK over 56k modems were an impediment to Java adoption. The relentless growth in JDK functionality caused the download size to swell, further impeding adoption. Compressing the JDK with Pack200 was a way to mitigate the problem. However, time has moved on: download speeds have improved, and JDK 9 introduced new compression schemes for both the Java runtime (JEP 220) and the modules used to build the runtime (JMOD). Consequently, JDK 9 and later do not rely on Pack200; JDK 8 was the last release compressed with pack200 at build time and uncompressed with unpack200 at install time. In summary, a major consumer of Pack200 -- the JDK itself -- no longer needs it.

  2. Beyond the JDK, it was attractive to compress client applications, and especially applets, with Pack200. Some deployment technologies, such as Oracle's browser plug-in, would uncompress applet JARs automatically. However, the landscape for client applications has changed, and most browsers have dropped support for plug-ins. Consequently, a major class of consumers of Pack200 -- applets running in browsers -- are no longer a driver for including Pack200 in the JDK.

  3. Pack200 is a complex and elaborate technology. Its file format is tightly coupled to the class file format and the JAR file format, both of which have evolved in ways unforeseen by JSR 200. (For example, JEP 309 added a new kind of constant pool entry to the class file format, and JEP 238 added versioning metadata to the JAR file format.) The implementation in the JDK is split between Java and native code, which makes it hard to maintain. The API in java.util.jar.Pack200 was detrimental to the modularization of the Java SE Platform, leading to the removal of four of its methods in Java SE 9. Overall, the cost of maintaining Pack200 is significant, and outweighs the benefit of including it in Java SE and the JDK.

Description

Three types in the java.base module previously annotated with @Deprecated(forRemoval=true) will be removed in the JDK feature release to which this JEP is ultimately targeted:

  • java.util.jar.Pack200
  • java.util.jar.Pack200.Packer
  • java.util.jar.Pack200.Unpacker

The jdk.pack module, which contains the pack200 and unpack200 tools, was previously annotated with @Deprecated(forRemoval=true) and will also be removed in the JDK feature release to which this JEP is ultimately targeted.

Risks and Assumptions

We assume that developers who rely on Pack200 have had enough notice about its proposed removal to make alternative arrangements. The deprecation-for-removal of Pack200 in JDK 11 was proposed and confirmed in June 2018, with no further interest in the topic since that time. (The Eclipse community, a significant consumer of Pack200, held discussions of its own (1, 2) but no further progress was reported.) The deprecation-for-removal of the Pack200 API was flagged in the Platform JSR for Java SE 11, and subsequently for Java SE 12 and Java SE 13. No comments were received on the Platform JSR's mailing lists (1, 2) about the proposed removal.

We assume that developers who use pack200 to shrink application JARs can switch to either the jlink tool or the jpackage tool to create application-specific runtimes with an optimized form factor. See JEP 282 and JEP 343 for more information about these tools. An early-access build of JDK 14 that includes jpackage is available.