Introduced in OpenJDK 8, compact profiles define subsets of the OpenJDK that reduce the static size of the Java runtime on devices that have limited storage capacity.
Introduction
A compact profile is a subset of the full OpenJDK. Because they have smaller storage footprints, compact profiles allow many Java applications to run on resource-constrained devices. Choosing a profile that closely matches an application's functional needs minimizes the storage devoted to unused functions.
Compact profiles address API choices only and are not related to the Java virtual machine, the language itself, or its tools.
Three compact profiles exist: "compact1", "compact2", and "compact3". Each compact profile includes the APIs of the lower-numbered profiles. For example, "compact2" is a superset of "compact1". The full OpenJDK is a superset of the "compact3" profile.
The table below shows the high-level composition of each compact profile:
Full OpenJDK | Beans | JNI | JAX-WS |
Preferences | Accessibility | IDL | |
RMI-IIOP | CORBA | Print Service | |
Sound | Swing | Java 2D | |
AWT | Drag and Drop | Input Methods | |
Image I/O | |||
compact3 | Security1 | JMX | |
XML JAXP2 | Management | Instrumentation | |
compact2 | JDBC | RMI | XML JAXP |
compact1 | Core (java.lang.* ) |
Security | Serialization |
Networking | Ref Objects | Regular Expressions | |
Date and Time | Input/Output | Collections | |
Logging | Concurrency | Reflection | |
JAR | ZIP | Versioning | |
Internationalization | JNDI | Override Mechanism | |
Extension Mechanism | Scripting |
1. Adds kerberos, acl, and sasl to compact1 Security.
2. Adds crypto to compact2 XML JAXP.
JDK 8 tools with explicit support for compact profiles are the following:
- The javac compiler: The
-profile
profile option directs the compiler to flag usage of an API not present in profile. - The
jdeps
static dependency analyze: The-profile
option shows the profile or file containing a package.
Details
The table below lists the API packages in each of the compact profiles.
compact1 | compact2 Additions | compact3 Additions |
---|---|---|
java.io | java.rmi | java.lang.instrument |
java.lang | java.rmi.activation | java.lang.management |
java.lang.annotation | java.rmi.dgc | java.security.acl |
java.lang.invoke | java.rmi.registry | java.util.prefs |
java.lang.ref | java.rmi.server | javax.annotation.processing |
java.lang.reflect | java.sql | javax.lang.model |
java.math | javax.rmi.ssl | javax.lang.model.element |
java.net | javax.sql | javax.lang.model.type |
java.nio | javax.transaction | javax.lang.model.util |
java.nio.channels | javax.transaction.xa | javax.management |
java.nio.channels.spi | javax.xml | javax.management.loading |
java.nio.charset | javax.xml.datatype | javax.management.modelmbean |
java.nio.charset.spi | javax.xml.namespace | javax.management.monitor |
java.nio.file | javax.xml.parsers | javax.management.openmbean |
java.nio.file.attribute | javax.xml.stream | javax.management.relation |
java.nio.file.spi | javax.xml.stream.events | javax.management.remote |
java.security | javax.xml.stream.util | javax.management.remote.rmi |
java.security.cert | javax.xml.transform | javax.management.timer |
java.security.interfaces | javax.xml.transform.dom | javax.naming |
java.security.spec | javax.xml.transform.sax | javax.naming.directory |
java.text | javax.xml.transform.stax | javax.naming.event |
java.text.spi | javax.xml.transform.stream | javax.naming.ldap |
java.time | javax.xml.validation | javax.naming.spi |
java.time.chrono | javax.xml.xpath | javax.security.auth.kerberos |
java.time.format | org.w3c.dom | javax.security.sasl |
java.time.temporal | org.w3c.dom.bootstrap | javax.sql.rowset |
java.time.zone | org.w3c.dom.events | javax.sql.rowset.serial |
java.util | org.w3c.dom.ls | javax.sql.rowset.spi |
java.util.concurrent | org.xml.sax | javax.tools |
java.util.concurrent.atomic | org.xml.sax.ext | javax.xml.crypto |
java.util.concurrent.locks | org.xml.sax.helpers | javax.xml.crypto.dom |
java.util.function | javax.xml.crypto.dsig | |
java.util.jar | javax.xml.crypto.dsig.dom | |
java.util.logging | javax.xml.crypto.dsig.keyinfo | |
java.util.regex | javax.xml.crypto.dsig.spec | |
java.util.spi | org.ietf.jgss | |
java.util.stream | ||
java.util.zip | ||
javax.crypto | ||
javax.crypto.interfaces | ||
javax.crypto.spec | ||
javax.net | ||
javax.net.ssl | ||
javax.script | ||
javax.security.auth | ||
javax.security.auth.callback | ||
javax.security.auth.login | ||
javax.security.auth.spi | ||
javax.security.auth.x500 | ||
javax.security.cert |