The
Java Class Library is a set of dynamically loadable libraries that
JavaJava 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 runtime. 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 librariesA 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
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 functions to perform common tasks, such as maintaining lists of items or performing complex string parsingIn computing, regular expressions provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters...
.
- In addition, the class libraries provide an abstract interface to tasks that would normally depend heavily on the hardware and operating system.
The
Java Class Library is a set of dynamically loadable libraries that
JavaJava 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 runtime. 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 librariesA 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
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 functions to perform common tasks, such as maintaining lists of items or performing complex string parsingIn computing, regular expressions provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters...
.
- 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
Computer networking is the engineering discipline concerned with communication between computer systems or devices. Networking, routers, routing protocols, and networking over the public Internet have their specifications defined in documents called RFCs...
access and fileA 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 the parts that need to have direct access to the
hardwareHardware is a general term for the physical artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
and
operating systemAn operating system is an interface between hardware and user which is responsible for the management and coordination of activities and the sharing of the resources of the computer that acts as a host for computing applications run on the machine. As a host, one of the purposes of an operating...
(as for
I/OIn 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 Graphic
RasterisationRasterization or 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 Java classes that give access to these functions commonly use
JNIThe Java Native Interface is a programming framework that allows 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 allows one to write native methods to handle...
wrappers to access the native API of the operating system.
Mostly all the Java classes of the library are contained in a single
JarIn computing, a JAR file aggregates many files into one. Software developers generally use .jar files to distribute Java classes and associated metadata.-Overview:...
file contained in the JRE or
JDKThe Java Development Kit is a Sun Microsystems 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...
distribution, called
rt.jar. Contrary to other libraries used by an application, the Class Library contained in
rt.jar is in the default Bootstrap Classpath , and so does not have to be included in the
ClasspathThe Classpath is an argument set on the command-line, or through an environment variable, that tells the Java Virtual Machine where to look for user-defined classes and packages in Java programs.-Overview and Architecture:...
declared for the application.
Conformance
Any Java implementation must pass the Java
Technology Compatibility KitA 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
classesIn object-oriented programming, a class is a construct that is used as a blueprint to create objects of that class. This blueprint describes the state and behavior that the objects of the class all share. An object of a given class is called an instance of the class. The class that contains that...
grouped by
packagesA 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
interfacesAn interface in the Java programming language is an abstract type that is used to specify an interface that classes must implement...
closely tied to the language and runtime system.
- I/O
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 networkingComputer networking is the engineering discipline concerned with communication between computer systems or devices. Networking, routers, routing protocols, and networking over the public Internet have their specifications defined in documents called RFCs...
: access to the platform file systemIn computing, a file system is a method for storing and organizing computer files and the data they contain to make it easy to find and access them...
, and more generally to networksA computer network is a group of interconnected computers. Networks may be classified according to a wide variety of characteristics. This article provides a general overview of some types and categories and also presents the basic components of a network....
, 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
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 expressionIn computing, regular expressions provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters...
s, ConcurrencyConcurrent computing is a form of computing in which programs are designed as collections of interacting computational processes that may be executed in parallel...
, loggingComputerized 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 compressionIn computer science and information theory, data compression or source coding is the process of encoding information using fewer bits than an unencoded representation would use, through use of specific encoding schemes.As with any communication, compressed data communication only works when both...
.
- 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 Graphics2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models and by techniques specific to them...
: the package supports basic GUI operations and binds to the underlying native system. It also contains the 2D Graphics API. The package is built on AWTThe 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...
and provides a platform independent widget toolkitA 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 feelPluggable 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
A music sequencer is software or hardware designed to create and manage computer-generated music....
, and synthesizingA synthesizer is an electronic instrument that is capable of producing a variety of sounds by generating and combining signals of different frequencies...
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 is a set of rules for encoding documents electronically. It is defined in the produced by the W3C and several other related specifications; all are fee-free open standards....
: built-in classes handle SAXSAX is a serial access parser API for XML. SAX provides a mechanism for reading data from an XML document. It is a popular alternative to the Document Object Model .- XML processing with SAX :...
, DOMThe 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...
, StAXStreaming 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 transformsXSL Transformations is a declarative XML-based language used for the transformation of XML documents into other 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...
, XPathXPath 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 serviceA Web service is defined by the W3C 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 protocolSOAP, 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
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, i.e...
and RMIThe Java Remote Method Invocation API, or Java RMI, is a Java application programming interface that performs the object-oriented equivalent of remote procedure calls ....
APIs, including a built-in ORBIn 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
A database is an integrated collection of logically related records or files consolidated into a common pool that provides data for one or more multiple uses....
s: access to SQLSQL is a database computer language designed for managing data in relational database management systems , and originally based upon Relational Algebra. Its scope includes data query and update, schema creation and modification, and data access control. SQL was one of the first languages for...
databases is provided through the package.
- Access to Scripting engines: the package gives access any Scripting language
A scripting language, script language or extension language is a programming language that allows control of one or more software applications. "Scripts" are distinct from the core code of the application, which is usually written in a different language, and are often created or at least modified...
that conforms to this API.
- Applets
A Java applet is an applet delivered to the 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. Java applets were introduced in the first version of the Java language in 1995...
: allows applications to be downloaded over a network and run within a guarded sandbox
- Java Beans: provides ways to manipulate reusable components.
Licensing
Following their promise to release a fully buildable
JDKThe Java Development Kit is a Sun Microsystems 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 codeIn computer science, source code is any collection of statements or declarations written in some human-readable computer programming language...
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 is to replace the parts that remain proprietary and closed source with alternative implementations and make the Class Library completely free and open source.
As of May 2008, the only part of the Class library that remain proprietary and closed-source (4% as of May 2007 for OpenJDK 7, and less than 1% as of May 2008 and OpenJDK 6) is
-
- The SNMP
Simple Network Management Protocol is a UDP-based network protocol. It is used mostly in network management systems to monitor network-attached devices for conditions that warrant administrative attention. SNMP is a component of the Internet Protocol Suite as defined by the Internet Engineering...
implementation.
Since the first May 2007 release,
Sun MicrosystemsSun Microsystems, Inc. is a multinational vendor of computers, computer components, computer software, and information technology services, founded on February 24, 1982...
, with the help of the community, has released as Open-source or replaced with Open-source alternatives almost all the encumbered code:
- All the audio engine code, including the software synthetizer
MIDI , ) is an industry-standard protocol defined in 1982 that enables electronic musical instruments such as keyboard controllers, computers, and other electronic equipment to communicate, control, 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 is the practice and study of hiding information. Modern cryptography intersects the disciplines of mathematics, computer science, and engineering...
classes used in the Class library have been released as Open-source,
- The code that scales and rasterizes
Rasterization or 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....
fontsA 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 most fonts are digital, used on computers.There are three basic kinds of...
has been replaced by FreeTypeFreeType is a software library written in C that implements a font rasterization engine. It is used to rasterize characters into bitmaps and provides support for other font-related operations....
- The native 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 LittleCMSLittleCMS or LCMS is an open source colour management system, released as a software library for use in other programs. 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
In digital signal processing, anti-aliasing is the technique of minimizing the distortion artifacts known as aliasing when representing a high-resolution signal at a lower resolution...
graphics rasterizerRasterization or 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 phoneMEIn 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 is an object-oriented scripting language used to enable programmatic access to objects within both the client application and other applications. It is primarily used in the form of client-side JavaScript, implemented as an integrated component of the web browser, allowing the...
plugin has been open-sourced (the JavaScript engineRhino 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).
Alternative implementations
GNU ClasspathGNU 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 runtimesFree Java implementations are software projects that implement Sun Microsystem's Java technologies and are distributed under free software licences, thus making them free software...
(like
KaffeKaffe 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...
,
SableVMSableVM 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...
,
JamVMJamVM 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 ....
,
CACAOCACAO is a research Java Virtual Machine developed at Vienna University of Technology. It compiles the class binaries while running , resulting in faster execution...
).
Apache HarmonyApache Harmony is an open source / free Java implementation, starting with Java SE 5.0. It will be licensed under the Apache License, Version 2...
is another free software class library. Its aim is to also implement the other parts of the Java stack (
Virtual MachineA Java Virtual Machine is a set of computer software programs and data structures that use a virtual machine model for the execution of other computer programs and scripts. The model used by a JVM accepts a form of computer intermediate language commonly referred to as Java bytecode...
,
CompilerA Java compiler is a compiler for the Java programming language. The most common form of output from a Java compiler are Java class files containing platform-neutral Java bytecode...
, and other tools required for any
Java implementationFree Java implementations are software projects that implement Sun Microsystem'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 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 is the effort by Sun Microsystems to release a fully buildable Java Development Kit based completely on free and open source code.- Sun's promise and initial release :Sun announced in JavaOne 2006 that Java would become open source software,...
- Free Java implementations
Free Java implementations are software projects that implement Sun Microsystem's Java technologies and are distributed under free software licences, thus making them free software...
- 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
A Java applet is an applet delivered to the 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. Java applets were introduced in the first version of the Java language in 1995...
External links