Jump to content

Java Class Library

From Alfawiki
Java Class Library
Company typeSoftware library
IndustrySoftware development
ProductsStandard class libraries for Java Platform

The Java Class Library (JCL) consists of a collection of dynamically loadable libraries that can be utilized at runtime by languages running on the JVM. Because the Java Platform operates independently of the underlying operating system, applications depend on JCL’s extensive standard class libraries to access common OS-level functions. Starting with Java 9, the JCL has been modularized and is accessed through the Java Platform Module System.

Within the JVM environment, JCL fulfills three primary functions:

  • Providing developers with a uniform set of tools such as container classes and utilities for regular expression processing.
  • Abstracting platform-specific operations like network communication and file management.
  • Simulating or identifying features that may be absent on certain platforms to maintain consistent application performance.

Implementation and configuration

The majority of JCL is implemented in Java, except for portions that depend on hardware or operating system specifics (for example, I/O and bitmap graphics) which are written in C++. These native components are typically accessed through Java Native Interface wrappers that interface with system-level APIs.

Most JCL classes are packaged within a single Java archive file called "rt.jar," which is included in both the JRE and JDK. This archive resides on the bootstrap classpath and is loaded by the bootstrap class loader automatically, without requiring explicit classpath settings.

With the introduction of Java 9, the previously monolithic "rt.jar" was replaced by a modularized structure managed via the Java Module System, allowing for clearer dependency management between modules and enhanced maintainability.

Conformance

All Java implementations must successfully complete the Java Technology Compatibility Kit tests to ensure compliance, including those related specifically to the JCL.

Main features

Access to JCL capabilities is provided through various classes organized into packages:

  • contains essential classes and interfaces fundamental to the language and runtime environment.
  • The I/O and networking packages enable interaction with platform file systems and networks using classes such as , , and . Networking support also extends to SCTP via .
  • The Mathematics package offers mathematical functions along with arbitrary-precision decimal and integer types.
  • Collections and utility packages provide built-in data structures, concurrency utilities, logging frameworks, regular expression handling, and compression tools.
  • Graphical user interface (GUI) components and 2D graphics are handled by the Abstract Window Toolkit (AWT) () which provides basic GUI functionality and native bindings including 2D graphics support. Building atop AWT, the Swing package () delivers a platform-independent widget toolkit featuring a pluggable look-and-feel system along with editable and non-editable text components.
  • Sound APIs facilitate reading, writing, sequencing, and synthesizing audio data.
  • Text processing capabilities are offered through , supporting text formatting for dates, numbers, and messages.
  • Image manipulation is supported by APIs in and , enabling image reading, writing, and editing.
  • XML-related functionality includes support for SAX, DOM, StAX parsing models, XSLT transformations, XPath queries, as well as web service APIs such as SOAP and JAX-WS.
  • Security features are provided by , with encryption algorithms supplied by .
  • Database connectivity to SQL databases is enabled through .
  • Scripting support is available via for any scripting language that adheres to the specification.
  • The applet package () allows applications downloaded over a network to run securely within a sandboxed environment.
  • The Java Beans package () supports reusable component management.
  • Runtime introspection and reflection capabilities are offered through java.lang.Class and associated classes in , enabling dynamic analysis of classes during execution.

Previous licensing

Prior to the advent of OpenJDK, the JDK was distributed under a proprietary license.

In accordance with its 2007 pledge to provide a fully buildable JDK composed almost entirely of free and open-source components, Sun Microsystems published the entire source code for the Class Library under the GPL on May 8, 2007. This release excluded certain third-party licensed elements that remained proprietary.[1]

Up until December 2010, the proprietary segments of the JDK continued to be supplied by Sun and later Oracle as Binary Plugs, which were necessary solely for compiling the JDK but not for its execution.<ref>As of May 2007, approximately 4% of OpenJDK 7's Class Library was proprietary, decreasing to less than 1% by May 2008 for OpenJDK 6.<ref> The main closed-source component was the SNMP implementation.

Since that initial release, both Sun and the community have either open-sourced or replaced nearly all encumbered elements:

  • The audio subsystem, including the software synthesizer, transitioned to open source. The proprietary synthesizer was superseded by Gervill, a synthesizer developed specifically for OpenJDK.
  • All classes related to cryptography were made available as open source.
  • Font scaling and rasterization utilize the open-source FreeType library.
  • Native color management is handled by the open-source LittleCMS, featuring a pluggable architecture that permits commercial Java editions to integrate proprietary solutions.
  • The anti-aliasing graphics rasterizer employs Pisces, an open-source renderer derived from the phoneME project.
  • The JavaScript plugin has been fully open-sourced; its engine, Rhino, was always available under an open-source license.

These developments have substantially diminished dependencies on proprietary components, thereby increasing OpenJDK’s attractiveness within enterprise environments and among developers.

Complete open source transition

Commencing in December 2010, all remaining proprietary binary plugs were substituted with fully open source alternatives, resulting in an entirely open-source JDK.

Alternative implementations

GNU Classpath serves as a leading free software class library for Java, concentrating exclusively on the Class Library and supporting multiple free Java runtimes, including Kaffe, SableVM, and JamVM.

Another initiative, Apache Harmony, was a free software project aimed at delivering a comprehensive Java platform implementation encompassing the Virtual Machine, Compiler, and essential tools necessary for a complete Java implementation.

See also

External links

  1. ↑ Sun intended to substitute these proprietary parts with open-source counterparts to achieve a completely open Class Library.