Java SE Embedded 8 Compact Profiles Overview

Java SE Embedded 8 introduces a new concept called, Compact Profiles, which enable reduced memory footprint for applications that do not require the entire Java platform. The Java SE 8 javac compiler has a new -profile option, which allows the application to be compiled using one of the new supported profiles.

There are three supported profiles: compact1, compact2 and compact3. These are additive layers, so that each Profile contains all of the APIs in the previous smaller Compact Profiles and adds appropriate APIs on top. The compact profiles feature is useful in small devices. It also can be used to shorten the time to download an application from a download server, such as an "App Store." It makes for more compact deployment of Java applications that bundle the JRE. A JRE can be configured with a compact profile, reducing its footprint for deployment along with a compact profile application.

Overview

A compact profile is a subset of the full Java SE Platform API. Because they have a smaller storage footprint, compact profiles can enable many Java applications to run on resource-constrained devices. Choosing a compact profile that closely matches an application's functional needs minimizes the storage devoted to unused functions. There are new embedded developer tools in Java SE Embedded 8 including jrecreate and jdeps, which allow a developer to customize the Compact Profile runtime environment for a platform, and to find the Compact Profile dependencies for analysis during platform development.

Compact profiles address API choices only; they are unrelated to the Java virtual machine, the language proper, or tools. So, care must be taken to match the Java virtual machine supported functionality with the API support needed.

There are three profiles, compact1, compact2, and compact3. Each profile includes the APIs of the lower-numbered profiles (compact2 is a superset of compact1). The full SE API is a superset of the compact3 profile. The following table shows the high-level composition of each:

Detailed Profile Composition

The following table lists the API packages in each of the compact profiles. The API Reference also defines profile composition.

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

Understanding which Compact Profile to Use

When developing applications for Compact Profiles, you must remember to only use the APIs found in the specifications for compact1, compact2, or compact3 profiles. Refer to the above Detailed Profile Comparison to see which Java packages exists in which Compact Profile. To ease in the programming of embedded apps for Compact Profiles, you can use the "jdeps" tool to see which Java packages are being used inside your source code after you have written your app. The result of running jdeps on your Java app will allow you to see which Compact Profile runtime you will need to be able to execute your application.

The results in the above example show that the compact1 profile is the minimum profile required to run the HelloWorld application. Therefore, the HelloWorld app must be run with compact1 Java SE Embedded 8 runtime.