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:

Full SE API Beans Input Methods IDL
  Preferences Accessibility Print Service
  RMI-IIOP CORBA Java 2D
  Sound Swing  
  AWT Drag and Drop  
  Image I/O  JAX-WS  
compact3 Security1 JMX JNDI
  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 JNI Override Mechanism
  Extension Mechanism Scripting  


1. Adds kerberos, acl, and sasl to compact1 Security.

2. Adds crypto to compact2 XML JAXP.

These JDK 8 tools have explicit support for profiles:

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.
 

Using the jdeps Tool


The following shows the usage of the jdeps tool:

$ jdeps
Usage: jdeps <options> <classes...>
where <classes> can be a pathname to a .class file, a directory, a JAR file,
or a fully-qualified classname or wildcard "*".  Possible options include:
  -s         --summary                 Print dependency summary only
  -v         --verbose                 Print additional information
  -V <level> --verbose-level=<level>   Print package-level or class-level dependencies
                                       Valid levels are: "package" and "class"
  -c <path>  --classpath=<path>        Specify where to find class files
  -p <pkg name> --package=<pkg name>   Restrict analysis to classes in this package
                                       (may be given multiple times)
  -e <regex> --regex=<regex>           Restrict analysis to packages matching pattern
                                       (-p and -e are exclusive)
  -P         --profile                 Show profile or the file containing a package
  -R         --recursive               Recursively traverse all dependencies
             --version                 Version information

 

A typical way to use jdeps is to use "-P" to print out the profiles that are being used by your app so that you can see which Compact Profile you must use to execute your application.

For example, here is a typical run of jdeps to discover which Compact Profile is the minimal that must be used to run the program:

% jdeps -P HelloWorld.class
 
HelloWorld.class -> /net/test11.us.example.com/export/java-re/jdk/8/ea/b124/binaries/linux-i586/jre/lib/rt.jar
   <unnamed> (HelloWorld.class)
      -> java.io                                            compact1
      -> java.lang                                          compact1


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.
 

Oracle Java SE Embedded version 8


Oracle Java SE Embedded version 8 Download




More Information

Other Java SE Embedded Downloads

Java SE Embedded System Requirements

Technical Documentation for Java SE Embedded is included in the download bundle for your convenience.
Java SE Embedded documentation can also be accessed online:

Java SE Embedded Documentation