The Java Class Library (JCL) is a set of
dynamically loadable libraries that
Java Virtual Machine (JVM) languages can call at
run time. Because the
Java Platform
Java is a set of computer software and specifications that provides a software platform for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms fr ...
is not dependent on a specific
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
, applications cannot rely on any of the platform-native libraries. Instead, the Java Platform provides a comprehensive set of
standard class libraries, containing the functions common to modern operating systems.
JCL serves three purposes within the JVM:
* Like other
standard code libraries, they provide the programmer a well-known set of useful facilities, such as
container classes and
regular expression
A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
processing.
* The library provides an abstract interface to tasks that would normally depend heavily on the hardware and operating system, such as
network access and
file access.
* Some underlying platforms may not support all of the features a Java application expects. In these cases, the library implementation can either emulate those features or provide a consistent way to check for the presence of a specific feature.
Implementation and configuration
JCL is almost entirely written in Java, except for the parts that need direct access to the
hardware and
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
(such as for
I/O or
bitmap graphics), which are instead written in
C++. The classes that give access to these functions commonly use
Java Native Interface wrappers to access operating system
APIs.
Almost all of JCL is stored in a single
Java archive file called "rt.jar" which is provided with
JRE and
JDK distributions. The Java Class Library (rt.jar) is located in the default bootstrap classpath and does not have to appear in the
classpath declared for the application. The
runtime uses the bootstrap class loader to find the JCL.
The
Java Module System (part of the
Java 9 release) broke the monolithic "rt.jar" JAR file and modularized the JCL itself in several modules with specified dependencies.
Conformance
Any Java implementation must pass the Java
Technology Compatibility Kit tests for compliance, which includes JCL tests.
Main features
JCL Features are accessed through
classes provided in
packages.
* contains fundamental classes and
interfaces closely tied to the language and
runtime system
In computer programming, a runtime system or runtime environment is a sub-system that exists in the computer where a program is created, as well as in the computers where the program is intended to be run. The name comes from the compile time ...
.
*
I/O and
networking access the platform
file system, and more generally
networks through the , and packages. For networking,
SCTP
The Stream Control Transmission Protocol (SCTP) is a computer networking communications protocol in the transport layer of the Internet protocol suite. Originally intended for Signaling System 7 (SS7) message transport in telecommunication, the ...
is available through .
*
Mathematics package: provides mathematical expressions and evaluation, as well as arbitrary-precision decimal and integer number datatypes.
*
Collections and Utilities : built-in Collection
data structure
In computer science, a data structure is a data organization and storage format that is usually chosen for Efficiency, efficient Data access, access to data. More precisely, a data structure is a collection of data values, the relationships amo ...
s, and utility classes, for
regular expression
A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
s,
concurrency,
logging
Logging is the process of cutting, processing, and moving trees to a location for transport. It may include skidder, skidding, on-site processing, and loading of trees or trunk (botany), logs onto logging truck, trucks[data compression
In information theory, data compression, source coding, or bit-rate reduction is the process of encoding information using fewer bits than the original representation. Any particular compression is either lossy or lossless. Lossless compressi ...]
.
*
GUI and
2D Graphics: the
AWT package () basic GUI operations and binds to the underlying native system. It also contains the 2D Graphics API. The
Swing package () is built on AWT and provides a platform-independent
widget toolkit, as well as a
pluggable look and feel. It also deals with editable and non-editable text components.
* Sound: interfaces and classes for reading, writing,
sequencing, and
synthesizing of sound data.
* Text: deals with text, dates, numbers and messages.
* Image package: and provide APIs to write, read, and modify images.
*
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
:
SAX,
DOM,
StAX,
XSLT transforms,
XPath
XPath (XML Path Language) is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) in 1999, and can be used to compute values (e.g., strings, numbers, or ...
and various APIs for
Web service
A web service (WS) is either:
* a service offered by an electronic device to another electronic device, communicating with each other via the Internet, or
* a server running on a computer device, listening for requests at a particular port over a n ...
s, as
SOAP protocol and
JAX-WS.
* Security is provided by and encryption services are provided by .
*
Database
In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and a ...
s: access to
SQL databases via
* Access to Scripting engines: The package gives access to any conforming
Scripting language
In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
.
*
Applets: allows applications to be downloaded over a network and run within a guarded sandbox
*
Java Beans: provides ways to manipulate reusable components.
* Introspection and reflection:
java.lang.Classrepresents a class, but other classes such as Method and Constructor are available in .
Licensing
Prior licenses
Before the release of OpenJDK, the
JDK was based on a
proprietary license.
Following their promise to release a fully buildable
JDK based on almost completely free and open-source code in the first half of 2007, Sun released the complete
source code
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
of the Class Library under the
GPL on May 8, 2007, except some limited parts that were licensed by Sun from third parties who did not want their code to be released under an open-source license. Sun's goal was to replace the parts that remain proprietary and closed source with alternative implementations and make the Class Library completely free and open source.
Until December 2010, the remaining encumbered part of the JDK was made available by
Sun then
Oracle
An oracle is a person or thing considered to provide insight, wise counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. If done through occultic means, it is a form of divination.
Descript ...
as ''Binary Plugs'' which were required to build the JDK but not necessary to run it. , the only part of the Class library that remained proprietary and closed-source (4% for OpenJDK 7, and less than 1% and OpenJDK 6) was the
SNMP implementation.
Since the first May 2007 release, Sun, with the help of the community, released as open-source or replaced with open-source alternatives almost all the encumbered code:
* All the audio engine code, including the
software synthesizer, became open source.
The closed-source software synthesizer has been replaced by a new synthesizer developed specifically for OpenJDK called ''Gervill'',
* All
cryptography
Cryptography, or cryptology (from "hidden, secret"; and ''graphein'', "to write", or ''-logy, -logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of Adversary (cryptography), ...
classes were released as open-source,
* The code that scales and
rasterizes fonts uses open source
FreeType
* The native
color management uses open-source
LittleCMS.
There is a pluggable layer in the JDK, so that the commercial release of Java can use the original, proprietary color management system and OpenJDK can use LittleCMS.
* The
anti-aliasing graphics
rasterizer code uses the open source Pisces renderer used in the
phoneME
A phoneme () is any set of similar Phone (phonetics), speech sounds that are perceptually regarded by the speakers of a language as a single basic sound—a smallest possible Phonetics, phonetic unit—that helps distinguish one word fr ...
project.
* The
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
plugin is open source (the
JavaScript engine itself was open source from the beginning).
Open source release
Beginning in December 2010, all the so-called ''binary plugs'' were replaced by
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
replacements, making the entire JDK open.
Alternative implementations
GNU Classpath is the other main free software class library for Java. Contrary to other implementations, it only implements the Class Library, and is used by many
free Java runtimes (like
Kaffe,
SableVM,
JamVM).
Apache Harmony was another free software class library. Its aim was to implement the other parts of the Java stack (
Virtual Machine
In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
,
Compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
, and other tools required for any
Java implementation).
See also
*
Java Platform, Standard Edition
Java Platform, Standard Edition (Java SE) is a computing platform for development and deployment of porting, portable code for desktop computer, desktop and server (computing), server environments. Java SE was formerly known as Java 2 Platform, S ...
*
List of Java APIs
*
OpenJDK
*
Free Java implementations
*
Standard library
In computer programming, a standard library is the library (computing), library made available across Programming language implementation, implementations of a programming language. Often, a standard library is specified by its associated program ...
*
Java applet
Java applets were applet, small applications written in the Java (programming language), Java programming language, or another programming language that Compiled language, compiles to Java bytecode, and delivered to users in the form of Ja ...
References
External links
Java SE Main page*
* Java software development kits (status ):
*
1.7(early development)
*
1.6(stable, current)
*
1.5(stable)
*
1.4(stable)
*
1.3(obsolete)
{{Sun Microsystems
Java (programming language)
Java (programming language) libraries