- Java Platform, Standard Edition
In practical terms, Java SE consists of a virtual machine, which must be used to run Java programs, together with a set of libraries (or "packages") needed to allow the use of
file systems, networks, graphical interfaces, and so on, from within those programs.
It must be noted that the expressions such as "super, this" or the return type "void" and the method "main()" are not part of the class hierarchy. Instead they are implemented in the JVM architecture.
Nomenclature, standards and specifications
Java SE was known as "Java 2 Platform, Standard Edition" or "J2SE" from version 1.2 until version 1.5. "SE" is used to distinguish the base platform from Java EE and Java ME. The "2" was originally intended to emphasize the major changes introduced in version 1.2, but was removed in version 1.6. The naming convention has been changed several times over the
Java version history.
Starting with J2SE 1.4 ("Merlin"), Java SE has been developed under the
Java Community Process. JSR 59 was the umbrella specification for J2SE 1.4 and JSR 176 specified J2SE 5.0 ("Tiger"). Java SE 6 ("Mustang") was released under JSR 270. Java Platform, Enterprise Editionis a related specification which includes all of the classes in Java SE, plus a number which are more useful to programs which run on servers as opposed to workstations. Java Platform, Micro Editionis a related specification intended to provide a certified collection of Java APIs for the development of software for small, resource-constrained devices such as cell phones,
JREand package=java. _ja. interfaces closely tied to the language and runtimesystem. This includes the root classes that form the class hierarchy, types tied to the language definition, basic exceptions, math functions, threading, security functions, as well as some information on the underlying native system. This package contains 22 of 32
Errorclasses provided in JDK 6.
The main classes in
* – the class that is the root of every class hierarchy. "(See also
Java syntax#Methods in the Object class.)"
* – the base class for enumeration classes (as of J2SE 5.0).
* – the class that is the root of the Java reflection system.
* – the class that is the base class of the exception class hierarchy.
*, Javadoc:SE|java/lang|Exception, and Javadoc:SE|java/lang|RuntimeException – the base classes for each exception type.
* – the class that allows operations on threads.
* – the class for strings and
* and Javadoc:SE|java/lang|StringBuilder – classes for performing string manipulation (
StringBuilderas of J2SE 5.0).
* – the interface that allows generic comparison and ordering of objects (as of J2SE 1.2).
* – the interface that allows generic iteration using the enhanced
forloop (as of J2SE 5.0).
*, Javadoc:SE|java/lang|Process, Javadoc:SE|java/lang|Runtime,Javadoc:SE|java/lang|SecurityManager, and Javadoc:SE|java/lang|System – classes that provide "system operations" that manage the dynamic loading of classes, creation of external processes, host environment inquiries such as the time of day, and enforcement of security policies.
* and Javadoc:SE|java/lang|StrictMath – classes that provide basic math functions such as
sine, cosine, and square root(
StrictMathas of J2SE 1.3).
primitive wrapper classes that encapsulate primitive types as objects.
* The basic exception classes thrown for language-level and other common exceptions.
java.langare automatically imported into every
= Javadoc:SE|package=java.lang.ref|java/lang/ref =
java.lang.refpackage provides more flexible types of references than are otherwise available, permitting limited interaction between the application and the
Java Virtual Machine(JVM) garbage collector. It is an important package, central enough to the language for the language designers to give it a name that starts with "java.lang", but it is somewhat special-purpose and not used by a lot of developers. This package was added in J2SE 1.2.
Java has a more expressive system of reference than most other garbage-collected
programming languages, which allows for special behavior for garbage collection. A normal reference in Java is known as a "strong reference". The
java.lang.refpackage defines three other types of references—"soft", "weak", and "phantom" references. Each type of reference is designed for a specific use.
A Javadoc:SE|java/lang/ref|SoftReference can be used to implement a
cache. An object that is not reachable by a strong reference (that is, not "strongly reachable"), but is referenced by a soft reference is called "softly reachable". A softly reachable object may be garbage collected at the discretion of the garbage collector. This generally means that softly reachable objects will only be garbage collected when free memory is low, but again, it is at the discretion of the garbage collector. Semantically, a soft reference means "keep this object unless the memory is needed."
A Javadoc:SE|java/lang/ref|WeakReference is used to implement weak maps. An object that is not strongly or softly reachable, but is referenced by a weak reference is called "
weakly reachable". A weakly reachable object will be garbage collected during the next collection cycle. This behavior is used in the class Javadoc:SE|package=java.util|java/util|WeakHashMap. A weak map allows the programmer to put key/value pairs in the map and not worry about the objects taking up memory when the key is no longer reachable anywhere else. Another possible application of weak references is the string intern pool. Semantically, a weak reference means "get rid of this object when nothing else references it."
A Javadoc:SE|java/lang/ref|PhantomReference is used to reference objects that have been marked for garbage collection and have been finalized, but have not yet been reclaimed. An object that is not strongly, softly or weakly reachable, but is referenced by a phantom reference is called "phantom reachable". This allows for more flexible cleanup than is possible with the finalization mechanism alone. Semantically, a phantom reference means "this object is no longer needed and has been finalized in preparation for being collected."
Each of these reference types extends the Javadoc:SE|java/lang/ref|Reference class which provides the Javadoc:SE|name=get()|java/lang/ref|Reference|get() method to return a strong reference to the referent object (or
nullif the reference has been cleared or if the reference type is phantom), and the Javadoc:SE|name=clear()|java/lang/ref|Reference|clear() method to clear the reference.
java.lang.refalso defines the class Javadoc:SE|java/lang/ref|ReferenceQueue, which can be used in each of the applications discussed above to keep track of objects that have changed reference type. When a
Referenceis created it is optionally registered with a reference queue. The application polls the reference queue to get references that have changed reachability state.
= Javadoc:SE|package=java.lang.reflect|java/lang/reflect =
Reflection is a constituent of the Java API which enables Java code to examine and "reflect" upon Java components at runtime and to use the reflected members. Classes in this package, along with
java.lang.Classand Javadoc:SE|package=java. _ja. Package accommodate applications such as
debuggers, interpreters, object inspectors, class browsers, and services such as object serializationand JavaBeansthat need access to either the public members of a target object (based on its runtime class) or the members declared by a given class. This package was added in JDK 1.1.
Reflection is used to instantiate classes and invoke methods using their names, a concept that allows for dynamic programming. Classes, interfaces, methods, fields, and constructors can all be discovered and used at runtime. Reflection is supported by
metadatathat the JVM has about the program. There are two basic techniques involved in reflection:
# "Discovery" involves taking an object or class and discovering the members, superclasses, implemented interfaces, and then possibly using the discovered elements.
# "Use by name" involves starting with the symbolic name of an element and using the named element.
Discovery typically starts with an object and calling the Javadoc:SE|java/lang|Object|getClass() method to get the object's
Classobject has several methods for discovering the contents of the class, for example:
* – returns an array of Javadoc:SE|java/lang/reflect|Method objects representing all the public methods of the class or interface
* – returns an array of Javadoc:SE|java/lang/reflect|Constructor objects representing all the public constructors of the class
* – returns an array of Javadoc:SE|java/lang/reflect|Field objects representing all the public fields of the class or interface
* – returns an array of
Classobjects representing all the public classes and interfaces that are members (e.g.
inner classes) of the class or interface
* – return the
Classobject representing the superclass of the class or interface (
nullis returned for interfaces)
* – returns an array of
Classobjects representing all the interfaces that are implemented by the class or interface
Use by name
Classobject can be obtained either through discovery, by using the "class literal" (e.g.
MyClass.class) or by using the name of the class (e.g. Javadoc:SE|name=Class.forName("mypackage.MyClass")|java/lang|Class|forName(java.lang.String)). With a
Fieldobjects can be obtained using the symbolic name of the member. For example:
* – returns the
Methodobject representing the public method with the name "methodName" of the class or interface that accepts the parameters specified by the
* – returns the
Constructorobject representing the public constructor of the class that accepts the parameters specified by the
* – returns the
Fieldobject representing the public field with the name "fieldName" of the class or interface.
Fieldobjects can be used to dynamically access the represented member of the class. For example:
* – returns an
Objectcontaining the value of the field from the instance of the object passed to
get(). (If the
Fieldobject represents a static field then the
Objectparameter is ignored and may be
* – returns an
Objectcontaining the result of invoking the method for the instance of the first
Objectparameter passed to
invoke(). The remaining
Object...parameters are passed to the method. (If the
Methodobject represents a
static methodthen the first
Objectparameter is ignored and may be
* – returns the new
Objectinstance from invoking the constructor. The
Object...parameters are passed to the constructor. (Note that the parameterless constructor for a class can also be invoked by calling Javadoc:SE|name=newInstance()|java/lang|Class|newInstance().)
Arrays and proxies
java.lang.reflectpackage also provides an Javadoc:SE|java/lang/reflect|Array class that contains static methods for creating and manipulating array objects, and since J2SE 1.3, a Javadoc:SE|java/lang/reflect|Proxy class that supports dynamic creation of proxy classes that implement specified interfaces.
The implementation of a
Proxyclass is provided by a supplied object that implements the Javadoc:SE|java/lang/reflect|InvocationHandler interface. The
InvocationHandler's Javadoc:SE|name=invoke(Object, Method, Object
)|java/lang/reflect|InvocationHandler|invoke(java.lang.Object,java.lang.reflect.Method,java.lang.Object ) method is called for each method invoked on the proxy object—the first parameter is the proxy object, the second parameter is the
Methodobject representing the method from the interface implemented by the proxy, and the third parameter is the array of parameters passed to the interface method. The
invoke()method returns an
Objectresult that contains the result returned to the code that called the proxy interface method.
= Javadoc:SE|package=java.io|java/io =
java.iopackage contains classes that support input and output. The classes in the package are primarily stream-oriented; however, a class for
random accessfiles is also provided. The central classes in the package are Javadoc:SE|java/io|InputStream and Javadoc:SE|java/io|OutputStream which are abstract base classes for reading from and writing to byte streams, respectively. The related classes Javadoc:SE|java/io|Reader and Javadoc:SE|java/io|Writer are abstract base classes for reading from and writing to character streams, respectively. The package also has a few miscellaneous classes to support interactions with the host file system.
The stream classes follow the
decorator patternby extending the base subclass to add features to the stream classes. Subclasses of the base stream classes are typically named for one of the following attributes:
* the source/destination of the stream data
* the type of data written to/read from the stream
* additional processing or filtering performed on the stream data
The stream subclasses are named using the naming
"Xxx"is the name describing the feature and
"StreamType"is one of
The following table shows the sources/destinations supported directly by the
Other standard library packages provide stream implementations for other destinations, such as the
InputStreamreturned by the Javadoc:SE|package=java.net|java/net|Socket|getInputStream() method or the Java EE Javadoc:EE|package=javax.servlet|javax/servlet|ServletOutputStream class.
Data type handling and processing or filtering of stream data is accomplished through stream filters. The filter classes all accept another compatible stream object as a parameter to the constructor and "decorate" the enclosed stream with additional features. Filters are created by extending one of the base filter classes Javadoc:SE|java/io|FilterInputStream, Javadoc:SE|java/io|FilterOutputStream, Javadoc:SE|java/io|FilterReader, or Javadoc:SE|java/io|FilterWriter.
Writerclasses are really just byte streams with additional processing performed on the data stream to convert the bytes to characters. They use the default
character encodingfor the platform, which as of J2SE 5.0 is represented by the Javadoc:SE|java/nio/charset|Charset returned by the Javadoc:SE|package=java.nio.charset|java/nio/charset|Charset|defaultCharset() static method. The Javadoc:SE|java/io|InputStreamReader class converts an
Readerand the Javadoc:SE|java/io|OutputStreamWriter class converts an
Writer. Both these classes have constructors that allow the character encoding to use to be specified—if no encoding is specified then the default encoding for the platform is used.
The following table shows the other processes and filters supported directly by the
java.iopackage. All of these classes extend the corresponding
The Javadoc:SE|java/io|RandomAccessFile class supports "
random access" reading and writing of files. The class uses a " file pointer" that represents a byte-offset within the file for the next read or write operation. The file pointer is moved implicitly by reading or writing and explicitly by calling the Javadoc:SE|name=seek(long)|java/io|RandomAccessFile|seek(long) or Javadoc:SE|name=skipBytes(int)|java/io|RandomAccessFile|skipBytes(int) methods. The current position of the file pointer is returned by the Javadoc:SE|name=getFilePointer()|java/io|RandomAccessFile|getFilePointer() method.
The Javadoc:SE|java/io|File class represents a file or directory path in a
Fileobjects support the creation, deletion and renaming of files and directories and the manipulation of
file attributes such as "read-only" and "last modified timestamp".
Fileobjects that represent directories can be used to get a list of all of the contained files and directories.
The Javadoc:SE|java/io|FileDescriptor class is a
file descriptorthat represents a source or sink (destination) of bytes. Typically this is a file, but can also be a console or network socket.
FileDescriptorobjects are used to create
Filestreams. They are obtained from
java.netsockets and datagram sockets.
= Javadoc:SE|package=java.nio|java/nio =
In J2SE 1.4, the package
java.nio(NIO or New I/O) was added to support
memory-mapped I/O, facilitating IOoperations closer to the underlying hardware with sometimes dramatically better performance. The
java.niopackage provides support for a number of buffer types. The subpackage Javadoc:SE|package=java.nio.charset|java/nio/charset provides support for different
character encodings for character data. The subpackage Javadoc:SE|package=java.nio.channels|java/nio/channels provides support for "channels," which represent connections to entities that are capable of performing I/O operations, such as files and sockets. The
java.nio.channelspackage also provides support for fine-grained locking of files.
= Javadoc:SE|package=java.math|java/math =
java.mathpackage supports multiprecision arithmetic (including modular arithmetic operations) and provides multiprecision prime number generators used for cryptographic key generation. The main classes of the package are:
* – provides arbitrary-precision signed decimal numbers.
BigDecimalgives the user control over rounding behavior through
* – provides arbitrary-precision integers. Operations on
BigIntegerdo not overflow or lose precision. In addition to standard arithmetic operations, it provides
modular arithmetic, GCD calculation, primality testing, prime numbergeneration, bitmanipulation, and other miscellaneous operations.
* – encapsulate the context settings which describe certain rules for numerical operators.
* – an enumeration that provides eight rounding behaviors.
= Javadoc:SE|package=java.net|java/net =
java.netpackage provides special IO routines for networks, allowing
HTTPrequests, as well as other common transactions.
= Javadoc:SE|package=java.text|java/text =
java.textpackage implements parsing routines for strings and supports various human-readable languages and locale-specific parsing.
= Javadoc:SE|package=java.util|java/util =
Data structures that aggregate objects are the focus of the
java.utilpackage. Included in the package is the
Collections API, an organized data structure hierarchy influenced heavily by the design patterns considerations.
Special purpose packages
= Javadoc:SE|package=java.applet|java/applet =
Created to support
Java appletcreation, the
java.appletpackage allows applications to be downloaded over a network and run within a guarded sandbox. Security restrictions are easily imposed on the sandbox. A developer, for example, may apply a
digital signatureto an applet, thereby labeling it as safe. Doing so allows the user to grant the applet permission to perform restricted operations (such as accessing the local hard drive), and removes some or all of the sandbox restrictions. Digital certificates are issued by certificate authorities.
= Javadoc:SE|package=java.beans|java/beans =
Included in the
java.beanspackage are various classes for developing and manipulating beans, reusable components defined by the JavaBeans architecture. The architecture provides mechanisms for manipulating properties of components and firing events when those properties change.
Most of the APIs in
java.beansare intended for use by a bean editing tool, in which beans can be combined, customized and manipulated. One type of bean editor is a GUI designer in an
integrated development environment.
= Javadoc:SE|package=java.awt|java/awt =
Abstract Window Toolkitprovides access to a basic set of GUIwidgets based on the underlying native platform's widget set, the core of the GUI event subsystem, and the interface between the native windowing system and the Java application. It also provides several basic layout managers, a datatransfer package for use with the Clipboard and Drag and Drop, the interface to input devices such as mice and
keyboards, as well as access to the
system trayon supporting systems. This package, along with
javax.swingcontains the maximum number of enums (7 in all) in JDK 6.
= Javadoc:SE|package=java.rmi|java/rmi =
Java remote method invocationto support remote procedure calls between two java applications running in different JVMs.
= Javadoc:SE|package=java.security|java/security =
Support for security, including the message digest algorithm, is included in the
= Javadoc:SE|package=java.sql|java/sql =
An implementation of the
JDBCAPI (used to access SQL databases) is grouped into the
= Javadoc:SE|package=javax.rmi|javax/rmi =
Provides the support for the remote communication between applications, using the RMI over IIOP protocol. This protocol combines RMI and CORBA features.
= Javadoc:SE|package=javax.swing|javax/swing =
Swing is a collection of routines that build on
java.awtto provide a platform independent
widget toolkit. Swing uses the 2D drawing routines to render the user interface components instead of relying on the underlying native operating systemGUI support.
This package contains the maximum number of classes (133 in all) in JDK 6. This package, along with
java.awtalso contains the maximum number of enums (7 in all) in JDK 6. Thus it is a very rich system in its own right, supporting pluggable looks and feels (PLAFs) so that widgets in the GUI can imitate those from the underlying native system. Design patterns permeate the system, especially a modification of the
model-view-controllerpattern, which loosens the coupling between function and appearance. One inconsistency is that (as of J2SE 1.3) fonts are drawn by the underlying native system, and not by Java, limiting text portability. Workarounds, such as using bitmap fonts, do exist. In general, "layouts" are used and keep elements within an aesthetically consistent GUI across platforms.
= Javadoc:SE|package=javax.swing.text.html.parser|javax/swing/text/html/parser =
Provides the error tolerant HTML parser that is used for writing various web browsers and web bots.
= Javadoc:SE|package=javax.xml.bind.annotation|javax/xml/bind/annotation =
This package contains the maximum number of Annotation Types (29 in all) in JDK 6. It defines annotations for customizing Java program elements to XML Schema mapping.
= Javadoc:SE|package=org.omg.CORBA|org/omg/CORBA =
Provides the support for the remote communication between applications using the
General Inter-ORB Protocoland supports other features of the common object request broker architecture. Same as RMI and RMI-IIOP, this package is for calling remote methods of objects on other virtual machines (usually via network).
This package contains the maximum number of
Exceptionclasses (45 in all) in JDK 6. From all communication possibilities CORBA is the most portable between various languages; however, with this comes more complexity.
= Javadoc:SE|package=org.omg.PortableInterceptor|org/omg/PortableInterceptor =
This package contains the maximum number of interfaces (39 in all) in JDK 6. It provides a mechanism to register ORB hooks through which ORB services can intercept the normal flow of execution of the ORB.
* [http://java.sun.com/javase/ Java SE Main page]
* [http://java.sun.com/reference/api/index.html Java SE API documentation]
* [http://www.jcp.org/en/jsr/detail?id=270 JSR 270] (Java SE 6)
* [http://www.jcp.org/en/jsr/detail?id=176 JSR 176] (J2SE 5.0)
* [http://www.jcp.org/en/jsr/detail?id=59 JSR 59] (J2SE 1.4)
* Java software development kits (status as of April 2008):
** [https://jdk7.dev.java.net/ 1.7] (early development)
** [http://java.sun.com/javase/6/ 1.6] (stable, current)
** [http://java.sun.com/j2se/1.5.0/ 1.5] (stable)
** [http://java.sun.com/j2se/1.4.2/ 1.4] (stable)
** [http://java.sun.com/j2se/1.3/ 1.3] (obsolete)
** [http://java.sun.com/products/archive/j2se/1.2.2_017/ 1.2] (no longer actively supported)
* [http://community.java.net/jdk/opensource/ Open Source Java]
* [http://java.sun.com/developer/JDCTechTips/index.html Java SE Tech Tips]
Wikimedia Foundation. 2010.
Look at other dictionaries:
Java Platform, Standard Edition 6 — Die Java Plattform (englisch Java Platform) definiert die Ablaufumgebung (Java Virtual Machine) und Programmierschnittstellen (Java Application Programming Interface) innerhalb der Java Technologie. Der Kern der Java Plattform ist die Java… … Deutsch Wikipedia
Java Platform Standard Edition — Die Java Platform, Standard Edition oder kurz Java SE (deutsch „Java Plattform, Standardausgabe“ bis Version 5.0 „Java 2 Platform, Standard Edition“, J2SE [ˌdʒeɪˈtuː ˌɛsˈiː]) ist eine Sammlung von Java APIs. Die Java SE dient als Grundlage für… … Deutsch Wikipedia
Java Platform, Standard Edition — Die Java Platform, Standard Edition oder kurz Java SE (deutsch „Java Plattform, Standardausgabe“ bis Version 5.0 „Java 2 Platform, Standard Edition“, J2SE [ˌdʒeɪˈtuː ˌɛsˈiː]) ist eine Sammlung von Java APIs. Die Java SE dient als Grundlage sowohl … Deutsch Wikipedia
Java Platform, Standard Edition — Java Card Micro Edition (ME) Standard Edition (SE) … Википедия
Java Platform Enterprise Edition — Java Platform, Enterprise Edition, abgekürzt Java EE oder früher J2EE, ist die Spezifikation einer Softwarearchitektur für die transaktionsbasierte Ausführung von in Java programmierten Anwendungen und insbesondere Web Anwendungen. Sie ist eine… … Deutsch Wikipedia
Java Platform, Micro Edition — Java editions Java Card Micro Edition (ME) Standard Edition (SE) Enterprise Edition (EE) … Wikipedia
Java Platform, Enterprise Edition — Java Platform, Enterprise Edition, abgekürzt Java EE oder früher J2EE, ist die Spezifikation einer Softwarearchitektur für die transaktionsbasierte Ausführung von in Java programmierten Anwendungen und insbesondere Web Anwendungen. Sie ist eine… … Deutsch Wikipedia
Java Platform Micro Edition — Java Platform, Micro Edition, abgekürzt Java ME [ˈdʒɑːvə ˌɛmˈiː], früher auch als Java Platform 2, Micro Edition oder kurz J2ME bezeichnet, ist eine Umsetzung der Programmiersprache Java für so genannte »embedded consumer products« wie etwa… … Deutsch Wikipedia
Java Platform, Micro Edition — Java Platform, Micro Edition, abgekürzt Java ME [ˈdʒɑːvə ˌɛmˈiː], früher auch als Java Platform 2, Micro Edition oder kurz J2ME bezeichnet, ist eine Umsetzung der Programmiersprache Java für so genannte »embedded consumer products« wie… … Deutsch Wikipedia
Java Platform, Enterprise Edition — or Java EE is a widely used platform for server programming in the Java programming language. The Java EE Platform differs from the Standard Edition (SE) of Java in that it adds libraries which provide functionality to deploy fault tolerant,… … Wikipedia