An Introduction to Java 8 Compact Profiles

Java SE is a very impressive platform indeed, but with all that functionality comes a large and ever increasing footprint.  It stands to reason then that one of the more frequent requests from the community has been the desire to deploy only those components required for a particular application instead of the entire Java SE runtime environment.  Referred to as subsetting, the benefits of such a concept would seem to be many:

  • A smaller Java environment would require less compute resources, thus opening up a new domain of devices previously thought to be too humble for Java.
  • A smaller runtime environment could be better optimized for performance and start up time.
  • Elimination of unused code is always a good idea from a security perspective.
  • If the environment could be pared down significantly, there may be tremendous benefit to bundling runtimes with each individual Java application.
  • These bundled applications could be downloaded more quickly.

Despite these perceived advantages, the platform stewards (Sun, then Oracle) have been steadfast in their resistance to subsetting.  The rationale for such a stance is quite simple: there was sincere concern that the Java SE platform would fragment.  Agree or disagree, the Java SE standard has remained remarkably in tact over time.  If you need any further evidence of this assertion, compare the state of Java SE to that of Java ME, particularly in the mobile telephony arena.  Better still, look how quickly Android has spawned countless variants in its brief lifespan.

Nonetheless, a formal effort has been underway having the stated goal of providing a much more modular Java platform.  Called Project Jigsaw, when complete, Java SE will be composed of a set of finer-grained modules and will include tools to enable developers to identify and isolate only those modules needed for their application.  However, implementing this massive internal change and yet maintaining compatibility has proven to be a considerable challenge.  Consequently full implementation of the modular Java platform has been delayed until Java 9.

Understanding that Java 9 is quite a ways off, an interim solution will be available for Java 8, called Compact Profiles.  Rather than specifying a complete module system, Java 8 will define subset profiles of the Java SE platform specification that developers can use to deploy.  At the current time three compact profiles have been defined, and have been assigned the creative names compact1, compact2, and compact3. The table that follows lists the packages that comprise each of the profiles.  Each successive profile is a superset of its predecessor.  That is to say, the compact2 profile contains all of the packages in compact1 plus those listed under the compact2 column below.  Likewise, compact3 contains all of compact2 packages plus the ones listed in the compact3 column.

compact1                     compact2                    compact3
--------------------------   -----------------------     --------------------------                      java.rmi                    java.lang.instrument
java.lang                    java.rmi.activation
java.lang.annotation         java.rmi.registry 
java.lang.invoke             java.rmi.server             java.util.prefs
java.lang.ref                java.sql                    javax.annotation.processing
java.lang.reflect            javax.rmi.ssl               javax.lang.model
java.math                    javax.sql                   javax.lang.model.element                     javax.transaction           javax.lang.model.type
java.nio                     javax.transaction.xa        javax.lang.model.util
java.nio.channels            javax.xml         
java.nio.channels.spi        javax.xml.datatype
java.nio.charset             javax.xml.namespace
java.nio.charset.spi         javax.xml.parsers 
java.nio.file.spi                  javax.xml.transform           javax.xml.transform.dom     javax.xml.transform.sax     javax.naming           javax.xml.transform.stax
java.text            javax.naming.event
java.text.spi                javax.xml.validation        javax.naming.ldap
java.util                    javax.xml.xpath             javax.naming.spi
java.util.concurrent         org.w3c.dom                 javax.script
java.util.concurrent.atomic  org.w3c.dom.bootstrap
java.util.jar                    javax.sql.rowset
java.util.logging            org.xml.sax                 javax.sql.rowset.serial
java.util.regex              org.xml.sax.ext             javax.sql.rowset.spi
java.util.spi                org.xml.sax.helpers                                            javax.xml.crypto
javax.crypto                                             javax.xml.crypto.dom
javax.crypto.interfaces                                  javax.xml.crypto.dsig
javax.crypto.spec                                        javax.xml.crypto.dsig.dom                                                javax.xml.crypto.dsig.keyinfo                                            javax.xml.crypto.dsig.spec                                      org.ieft.jgss

You may ask what savings can be realized by using compact profiles?  As Java 8 is in pre-release stage, numbers will change over time, but let's take a look at a snapshot early access build of Java SE-Embedded 8 for ARMv5/Linux.  A reasonably configured compact1 profile comes in at less than 14MB.  Compact2 is about 18MB and compact3 is in the neighborhood of 21MB.  For reference, the latest Java 7u21 SE Embedded ARMv5/Linux environment requires 45MB.

So at less than one-third the original size of the already space-optimized Java SE-Embedded release, you have a very capable runtime environment.  If you need the additional functionality provided by the compact2 and compact3 profiles or even the full VM, you have the option of deploying your application with them instead.

In the next installment, we'll look at Compact Profiles in a bit more detail.


Don't any tools exist to produce a stripped down JVM containing a minimal footprint needed to run a particular application ? Given how much information is kept in jar files, and given how long the jvm has been around - this doesn't sound like asking for a miracle...

Posted by Faz on July 31, 2013 at 07:45 PM EDT #

This seems to be very much on lines of plug-able and composable runtime with pre-build profiles. Can not this be custom? Or it is J2SE 9 goal?

Next set of App servers will also have to provide such a capability making things to be available in a composable way and then on-demand, something that WAS Liberty is already able to do.

Posted by guest on September 18, 2013 at 05:39 AM EDT #

The custom capability you ask for will be part of Java 9. Compact Profiles are an interim solution which subset the JRE into a small number of options, each with well known functionality. As Java 9 won't be out for quite a bit, compact profiles aren't going away any time soon. In fact we've modified many Java SE tools to compact profile aware, including javac, jar and the java command.

If you want to see a video demonstrating compact profiles, check out the blog entry that follows this one:

Posted by guest on September 18, 2013 at 08:34 AM EDT #

The concept of compact profile is a good start.

I would think one can customize these because many applications/projects would have classes/libraries that overlap at least two of these profiles.

Posted by Derek on September 18, 2013 at 11:46 AM EDT #

The compact packages listed don't include any UI packages, (awt, swing, JavaFX). Are there compact profiles which include JavaFX or other UI technologies?

Posted by John on September 20, 2013 at 04:47 PM EDT #

The Three compact profiles introduced so far do not include any graphic components. I'd be curious to see if anything is said about the prospects of some kind of JavaFX profile ate Java One 2013.

Posted by guest on September 20, 2013 at 05:05 PM EDT #

I have downloaded JDK8 developer preview. But I did not see jrecreate scripts anywhere. Is Compact Profiles still included anywhere?

Posted by Tony on December 14, 2013 at 01:42 PM EST #

The subsequent blog post entitled Compact Profiles Demonstrated ( exaplains the current availabilility of the Java 8 SE-Embedded Early Access (with the jrecreate tool):

"Members of the Oracle Partner Network (OPN) with a gold membership or higher can download the early access Java 8 binaries of Java SE-Embedded shown here. For those not at this level, it may still be possible to get early access software, but it will require a qualification process beforehand."

Posted by guest on December 16, 2013 at 09:41 PM EST #

Does that mean Compact Profile will only be available in Java SE Embedded? I am looking for a way to make a more compact version of the standard desktop Java SE.

Posted by Tony on December 17, 2013 at 12:17 AM EST #

Referring to the subsequent blog post entitled Compact Profiles Demonstrated (, the full toolset and space optimizations are only available for Java SE-Embedded. However, you can use a form of Compact Profiles with the standard OpenJDK release:

"It's not as intimidating as it sounds, you can pull down the source code for OpenJDK 8, and build it yourself ( By default, compact profiles are not built, but this forum post shows you how ( The reference platform for this software is linux/x86. Functionally, the generated compact profiles will contain the pared down modules for each compact profile, but you'll find the footprint for each to be much larger than the ones demonstrated in this video, as none of the Java SE-Embedded space optimizations are performed by default."

Posted by guest on December 17, 2013 at 09:17 AM EST #

Hi, Why java.beans isn't in compact profiles. I think it is useful.

Posted by Jeff Zhang on January 15, 2014 at 10:23 PM EST #

I keep trying to figure out a how to get jdwp to work with Embedded Java, using either a full jre or compact3 profile. In both cases, it cannot find

According to the document below, it should be supported, except in the minimal VM option of the JRE. I am using the ARMv5 Linux (linux-arm-sflt) version, which I suspect might not include this anymore? It was in the EJRE7 though, so I'm surprised it is missing now. Does anyone know about this?

Posted by Ben on April 24, 2014 at 01:53 PM EDT #

Did you issue the jrecreate command with the '--debug' option?

Posted by guest on April 24, 2014 at 03:26 PM EDT #

For future readers, jdwp requires --debug option on

Thanks to Jim Connors for the answer (and the post!).

Posted by Ben on April 24, 2014 at 04:48 PM EDT #

Hi! Is the compact1 profile backward compatible with CDC-1.1/FP-1.1 java code?

Posted by guest on August 07, 2014 at 01:18 PM EDT #

In general, our experience is that customers have had good success moving applications from CDC to Java SE Embedded with Compact Profiles. With compact1, migration from CDC/FP to Java 8 SE was one of the main factors determining which APIs were and were not not included.

That being said we cannot guarantee all CDC/FP applicaitions will run on Java SE Embedded compact1 implementations. There have been numerous bug fixes and improvements (most notably security fixes) to the APIs as compared to the very dated CDC/FP APIs that might impact application compatibility.

Posted by Jim Connors on August 15, 2014 at 03:42 PM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Jim Connors-Oracle


« July 2016