Compact
API Profiles
JDK 8 adds a feature that
organizes subsets of the API library into what are called compact profiles. These
are called compact1, compact2, and compact3. Each profile
contains a subset of the library.
Furthermore, compact2 includes all
of compact1, and compact3 includes all of compact2. Thus, each profile builds on
the previous one. The advantage of the compact profiles is that an application
that does not require the full library need not download it. Using a compact
profile reduces the size of the library, thus enabling some types of Java
applications to run on devices that could not otherwise support the entire Java
API. The use of a compact profile can also reduce the time it takes to load a
program. The Java API documentation indicates to which (if any) profile each
API element belongs.
When compiling a program, you
can determine if a program uses only APIs defined by a compact profile by using
the -profile option. Here is its
general form:
javac -profile profileName programName
Here, profileName specifies the profile, which must be compact1, compact2, or compact3.
For example:
javac -profile compact2 Test.java
Here, the compact2 profile is specified. If Test.java contains an API that is not
part of compact2, then a compilation
error will result.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.