Java Class Library
Encyclopedia
The Java Class Library is a set of dynamically loadable libraries that Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 applications can call at run time. Because the Java Platform is not dependent on any specific operating system, applications cannot rely on any of the existing libraries. Instead, the Java Platform provides a comprehensive set of standard class libraries
Standard library
A standard library for a programming language is the library that is conventionally made available in every implementation of that language. In some cases, the library is described directly in the programming language specification; in other cases, the contents of the standard library are...

, containing much of the same reusable functions commonly found in modern operating systems.

The Java class libraries serve three purposes within the Java Platform:
  • Like other standard code libraries
    Standard library
    A standard library for a programming language is the library that is conventionally made available in every implementation of that language. In some cases, the library is described directly in the programming language specification; in other cases, the contents of the standard library are...

    , they provide the programmer a well-known set of useful facilities, such as container classes and regular expression
    Regular expression
    In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...

    s.
  • In addition, the class libraries provide an abstract interface to tasks that would normally depend heavily on the hardware and operating system. Tasks such as network access and file
    Computer file
    A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished...

     access are often heavily dependent on the native capabilities of the platform.
  • Finally, some underlying platforms may not support all of the features a Java application expects. In these cases, the class libraries can either emulate those features using whatever is available, or provide a consistent way to check for the presence of a specific feature.

Architecture

The Java Class Library is almost entirely written in Java itself, except for the parts that need direct access to the hardware
Hardware
Hardware is a general term for equipment such as keys, locks, hinges, latches, handles, wire, chains, plumbing supplies, tools, utensils, cutlery and machine parts. Household hardware is typically sold in hardware stores....

 and operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 (such as for I/O
Input/output
In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world, possibly a human, or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it...

, or bitmap graphics
Rasterisation
Rasterisation is the task of taking an image described in a vector graphics format and converting it into a raster image for output on a video display or printer, or for storage in a bitmap file format....

). The classes that give access to these functions commonly use native interface
Java Native Interface
The Java Native Interface is a programming framework that enables Java code running in a Java Virtual Machine to call and to be called by native applications and libraries written in other languages such as C, C++ and assembly.-Purpose and features:JNI enables one to write native methods to...

 wrappers to access the API of the operating system.

Almost all of the Java Class Library is stored in a single Java archive
JAR (file format)
In software, JAR is an archive file format typically used to aggregate many Java class files and associated metadata and resources into one file to distribute application software or libraries on the Java platform.JAR files are built on the ZIP file format and have the .jar file extension...

 file called "rt.jar", which is provided with JRE and JDK
Java Development Kit
The Java Development Kit is an Oracle Corporation product aimed at Java developers. Since the introduction of Java, it has been by far the most widely used Java SDK. On 17 November 2006, Sun announced that it would be released under the GNU General Public License , thus making it free software...

 distributions. The Java Class Library (rt.jar) is located in the default bootstrap classpath, and does not have to be found in the classpath
Classpath (Java)
Classpath is a parameter—set either on the command-line, or through an environment variable—that tells the Java Virtual Machine or the compiler where to look for user-defined classes and packages.-Overview and architecture:...

 declared for the application.

Conformance

Any Java implementation must pass the Java Technology Compatibility Kit
Technology Compatibility Kit
A Technology Compatibility Kit is a suite of tests that at least nominally checks a particular alleged implementation of a Java Specification Request for compliance...

 tests for compliance.

Main Features

Features of the Class Library are accessed through classes
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

 grouped by packages
Java package
A Java package is a mechanism for organizing Java classes into namespaces similar to the modules of Modula. Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time...

. contains fundamental classes and interfaces
Interface (Java)
An interface in the Java programming language is an abstract type that is used to specify an interface that classes must implement. Interfaces are declared using the interface keyword, and may only contain method signature and constant declarations...

 closely tied to the language and runtime system.
  • I/O
    Input/output
    In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world, possibly a human, or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it...

     and networking: access to the platform file system
    File system
    A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

    , and more generally to networks
    Computer network
    A computer network, often simply referred to as a network, is a collection of hardware components and computers interconnected by communication channels that allow sharing of resources and information....

    , is provided through the , , and packages.
  • Mathematics package: provides regular mathematical expressions, as well as arbitrary-precision decimals and integers numbers.
  • Collections and Utilities : provide built-in Collection data structure
    Data structure
    In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...

    s, and various utility classes, for Regular expression
    Regular expression
    In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...

    s, Concurrency
    Concurrent computing
    Concurrent computing is a form of computing in which programs are designed as collections of interacting computational processes that may be executed in parallel...

    , logging
    Computer data logging
    Computer data logging is the process of recording events, with an automated computer program, in a certain scope in order to provide an audit trail that can be used to understand the activity of the system and to diagnose problems....

     and Data compression
    Data compression
    In computer science and information theory, data compression, source coding or bit-rate reduction is the process of encoding information using fewer bits than the original representation would use....

    .
  • GUI
    Gui
    Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

     and 2D Graphics
    2D computer graphics
    2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models and by techniques specific to them...

    : the AWT
    Abstract Window Toolkit
    The Abstract Window Toolkit is Java's original platform-independent windowing, graphics, and user-interface widget toolkit. The AWT is now part of the Java Foundation Classes — the standard API for providing a graphical user interface for a Java program.AWT is also the GUI toolkit for a...

     package supports basic GUI operations and binds to the underlying native system. It also contains the 2D Graphics API. The Swing
    Swing (Java)
    Swing is the primary Java GUI widget toolkit. It is part of Oracle's Java Foundation Classes — an API for providing a graphical user interface for Java programs....

     package is built on AWT and provides a platform independent widget toolkit
    Widget toolkit
    In computing, a widget toolkit, widget library, or GUI toolkit is a set of widgets for use in designing applications with graphical user interfaces...

    , as well as a Pluggable look and feel
    Pluggable look and feel
    Pluggable look and feel is a mechanism used in the Java Swing widget toolkit allowing to change the look and feel of the graphical user interface at runtime....

    . It also deals with editable and non-editable text components.
  • Sound: provides interfaces and classes for reading, writing, sequencing
    Music sequencer
    The music sequencer is a device or computer software to record, edit, play back the music, by handling note and performance information in several forms, typically :...

    , and synthesizing
    Synthesizer
    A synthesizer is an electronic instrument capable of producing sounds by generating electrical signals of different frequencies. These electrical signals are played through a loudspeaker or set of headphones...

     of sound data.
  • Text: the package deals with text, dates, numbers, and messages.
  • Image package: and provide APIs to write, read, and modify images.
  • XML
    XML
    Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

    : built-in classes handle SAX
    Simple API for XML
    SAX is an event-based sequential access parser API developed by the XML-DEV mailing list for XML documents. SAX provides a mechanism for reading data from an XML document that is an alternative to that provided by the Document Object Model...

    , DOM
    Document Object Model
    The Document Object Model is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. Aspects of the DOM may be addressed and manipulated within the syntax of the programming language in use...

    , StAX
    StAX
    Streaming API for XML is an application programming interface to read and write XML documents, originating from the Java programming language community.Traditionally, XML APIs are either:...

    , XSLT transforms
    XSL Transformations
    XSLT is a declarative, XML-based language used for the transformation of XML documents. The original document is not changed; rather, a new document is created based on the content of an existing one. The new document may be serialized by the processor in standard XML syntax or in another format,...

    , XPath
    XPath
    XPath is a language for selecting nodes from an XML document. In addition, XPath may be used to compute values from the content of an XML document...

    , and various APIs for Web service
    Web service
    A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...

    s, as SOAP protocol
    SOAP
    SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks...

     and JAX-WS.
  • CORBA
    Common Object Request Broker Architecture
    The Common Object Request Broker Architecture is a standard defined by the Object Management Group that enables software components written in multiple computer languages and running on multiple computers to work together .- Overview:CORBA enables separate pieces of software written in different...

     and RMI
    Java remote method invocation
    The Java Remote Method Invocation Application Programming Interface , or Java RMI, is a Java application programming interface that performs the object-oriented equivalent of remote procedure calls ....

     APIs, including a built-in ORB
    Object request broker
    In distributed computing, an object request broker is a piece of middleware software that allows programmers to make program calls from one computer to another via a network...

  • Security and Cryptography
  • Database
    Database
    A database is an organized collection of data for one or more purposes, usually in digital form. The data are typically organized to model relevant aspects of reality , in a way that supports processes requiring this information...

    s: access to SQL
    SQL
    SQL is a programming language designed for managing data in relational database management systems ....

     databases is provided through the package.
  • Access to Scripting engines: the package gives access to any Scripting language
    Scripting language
    A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

     that conforms to this API.
  • Applets
    Java applet
    A Java applet is an applet delivered to users in the form of Java bytecode. Java applets can run in a Web browser using a Java Virtual Machine , or in Sun's AppletViewer, a stand-alone tool for testing applets...

    : allows applications to be downloaded over a network and run within a guarded sandbox
  • Java Beans: provides ways to manipulate reusable components.

Before May 2007

Before the release of OpenJDK, the JDK
Java Development Kit
The Java Development Kit is an Oracle Corporation product aimed at Java developers. Since the introduction of Java, it has been by far the most widely used Java SDK. On 17 November 2006, Sun announced that it would be released under the GNU General Public License , thus making it free software...

 was based on a proprietary license
Proprietary software
Proprietary software is computer software licensed under exclusive legal right of the copyright holder. The licensee is given the right to use the software under certain conditions, while restricted from other uses, such as modification, further distribution, or reverse engineering.Complementary...

.

OpenJDK release (May 2007)

Following their promise to release a fully buildable JDK
Java Development Kit
The Java Development Kit is an Oracle Corporation product aimed at Java developers. Since the introduction of Java, it has been by far the most widely used Java SDK. On 17 November 2006, Sun announced that it would be released under the GNU General Public License , thus making it free software...

 based almost completely on free and open source code in the first half of 2007, Sun released the complete source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

 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 a free and 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.

Before December 2010

Until December 2010, the remaining encumbered part of the JDK was made available by Sun
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

 then Oracle
Oracle Corporation
Oracle Corporation is an American multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products – particularly database management systems...

 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
    Simple Network Management Protocol
    Simple Network Management Protocol is an "Internet-standard protocol for managing devices on IP networks. Devices that typically support SNMP include routers, switches, servers, workstations, printers, modem racks, and more." It is used mostly in network management systems to monitor...

     implementation.


Since the first May 2007 release, Sun Microsystems
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

, 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 synthetizer
    Musical Instrument Digital Interface
    MIDI is an industry-standard protocol, first defined in 1982 by Gordon Hall, that enables electronic musical instruments , computers and other electronic equipment to communicate and synchronize with each other...

    , has been released as Open-source. The closed-source software synthesizer has been replaced by a new synthesizer developed specifically for OpenJDK called Gervill,
  • All cryptography
    Cryptography
    Cryptography is the practice and study of techniques for secure communication in the presence of third parties...

     classes used in the Class library have been released as Open-source,
  • The code that scales and rasterizes
    Rasterisation
    Rasterisation is the task of taking an image described in a vector graphics format and converting it into a raster image for output on a video display or printer, or for storage in a bitmap file format....

     fonts
    Computer font
    A computer font is an electronic data file containing a set of glyphs, characters, or symbols such as dingbats. Although the term font first referred to a set of metal type sorts in one style and size, since the 1990s it is generally used to refer to a scalable set of digital shapes that may be...

     has been replaced by FreeType
    FreeType
    FreeType is a software library written in C that implements a font rasterization engine. It is used to render text on to bitmaps and provides support for other font-related operations.-Details:...

  • The native color management
    Color management
    In digital imaging systems, color management is the controlled conversion between the color representations of various devices, such as image scanners, digital cameras, monitors, TV screens, film printers, computer printers, offset presses, and corresponding media.The primary goal of color...

     system has been replaced by LittleCMS
    LittleCMS
    LittleCMS or LCMS is an open source color management system, released as a software library for use in other programs which will allow the use of International Color Consortium profiles. It is licenced under the MIT License Agreement....

    . There is a pluggable layer in the JDK, so that the commercial version can use the old color management system and OpenJDK can use LittleCMS.
  • The anti-aliasing
    Anti-aliasing
    In digital signal processing, spatial anti-aliasing is the technique of minimizing the distortion artifacts known as aliasing when representing a high-resolution image at a lower resolution...

     graphics rasterizer
    Rasterisation
    Rasterisation is the task of taking an image described in a vector graphics format and converting it into a raster image for output on a video display or printer, or for storage in a bitmap file format....

     code has been replaced by the Open-sourced Pisces renderer used in the phoneME
    Phoneme
    In a language or dialect, a phoneme is the smallest segmental unit of sound employed to form meaningful contrasts between utterances....

     project. This code is fully functional, but still needs some performance enhancements,
  • The Javascript
    JavaScript
    JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

     plugin has been open-sourced (the JavaScript engine
    Rhino (JavaScript engine)
    Rhino is an open source JavaScript engine. It is developed entirely in Java and managed by the Mozilla Foundation. The Foundation also provides another implementation of JavaScript engine written in C known as SpiderMonkey....

     itself was open-sourced from the beginning).

After December 2010

Beginning in December 2010, all the so called binary plugs were replaced by Open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 replacements, making the whole JDK open sourced and the binary plugs not necessary anymore.

Alternative implementations

GNU Classpath
GNU Classpath
GNU Classpath is a project aiming to create a free software implementation of the standard class library for the Java programming language. Despite the massive size of the library to be created, the majority of the task is already done, including Swing, CORBA, and other major parts. The 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
Free Java implementations
Free Java implementations are software projects that implement Oracle's Java technologies and are distributed under free software licences, thus making them free software...

 (like Kaffe
Kaffe
Kaffe is a clean room design of a Java Virtual Machine. It comes with a subset of the Java Platform, Standard Edition , Java API, and tools needed to provide a Java runtime environment. Like most other Free Java virtual machines, Kaffe uses GNU Classpath as its class library.Kaffe, first released...

, SableVM
SableVM
SableVM is a clean room implementation of Java bytecode interpreter implementing the Java virtual machine specification, second edition.SableVM was designed to be a robust, extremely portable, efficient, and fully specifications-compliant Java Virtual Machine that would be easy to maintain and to...

, JamVM
JamVM
JamVM is an open source Java Virtual Machine developed to be extremely small compared with other virtual machines while conforming to the Java virtual machine specification version 2 ....

, CACAO
CACAO
CACAO is a research Java Virtual Machine developed at Vienna University of Technology. It compiles the class binaries while running , resulting in faster execution...

).

Apache Harmony
Apache Harmony
Apache Harmony was an open source, free Java implementation, developed by the Apache Software Foundation. It was announced in early May 2005 and on October 25, 2006, the Board of Directors voted to make Apache Harmony a top-level project...

 was another free software class library. Its aim was to also implement the other parts of the Java stack (Virtual Machine
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...

, Compiler
Java compiler
A Java compiler is a compiler for the Java programming language. The most common form of output from a Java compiler is Java class files containing platform-neutral Java bytecode...

, and other tools required for any Java implementation
Free Java implementations
Free Java implementations are software projects that implement Oracle's Java technologies and are distributed under free software licences, thus making them free software...

).

See also

  • Java Platform, Standard Edition
    Java Platform, Standard Edition
    Java Platform, Standard Edition or Java SE is a widely used platform for programming in the Java language. It is the Java Platform used to deploy portable applications for general use...

  • List of Java APIs
  • OpenJDK
    OpenJDK
    OpenJDK is a free and open source implementation of the Java programming language. It is the result of an effort Sun Microsystems began in 2006...

  • Free Java implementations
    Free Java implementations
    Free Java implementations are software projects that implement Oracle's Java technologies and are distributed under free software licences, thus making them free software...

  • Standard library
    Standard library
    A standard library for a programming language is the library that is conventionally made available in every implementation of that language. In some cases, the library is described directly in the programming language specification; in other cases, the contents of the standard library are...

  • Java applet
    Java applet
    A Java applet is an applet delivered to users in the form of Java bytecode. Java applets can run in a Web browser using a Java Virtual Machine , or in Sun's AppletViewer, a stand-alone tool for testing applets...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK