World Library  
Flag as Inappropriate
Email this Article

Java SE

Article Id: WHEBN0003751821
Reproduction Date:

Title: Java SE  
Author: World Heritage Encyclopedia
Language: English
Subject: Sun Microsystems, Java Platform, Micro Edition, OS X Server, Java Community Process, NetBeans, Eclipse (software), JXTA, WebObjects, Java Metadata Interface, Java Architecture for XML Binding
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Java SE

Java Platform, Standard Edition or Java SE is a widely used platform for development and deployment of portable applications for desktop and server environments.[1] Java SE uses object-oriented Java programming language. Strictly speaking, Java SE is a platform specification. It defines a wide range of general purpose APIs—such as Java APIs for the Java Class Library—and also includes the Java Language Specification and the Java Virtual Machine Specification.[2] One of the most well known implementations of Java SE is Oracle Corporation's Java Development Kit (JDK).[3]

Nomenclature, standards and specifications

Java SE was known as Java 2 Platform, Standard Edition or J2SE from version 1.2 until version 1.5. The "SE" is used to distinguish the base platform from the Enterprise Edition (Java EE) and Micro Edition (Java ME) platforms. 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, which produces descriptions of proposed and final specifications for the Java platform called Java Specification Requests (JSR).[4] 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 Edition (Java EE) is a related specification that includes all the classes in Java SE, plus a number that are more useful to programs that run on servers as opposed to workstations.

Java Platform, Micro Edition (Java ME) is 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, PDAs and set-top boxes.

The Java Runtime Environment (JRE) and Java Development Kit (JDK) are the actual files downloaded and installed on a computer to run or develop Java programs, respectively.

General purpose packages

java.lang

The exceptions, math functions, threading, security functions, as well as some information on the underlying native system. This package contains 22 of 32 Error classes provided in JDK 6.

The main classes and interfaces in java.lang are:

  • Object – the class that is the root of every class hierarchy.
  • enumeration classes (as of J2SE 5.0).
  • Class – the class that is the root of the Java reflection system.
  • Throwable – the class that is the base class of the exception class hierarchy.
  • RuntimeException – the base classes for each exception type.
  • Thread – the class that allows operations on threads.
  • string literals.
  • string manipulation (StringBuilder as of J2SE 5.0).
  • Comparable – the interface that allows generic comparison and ordering of objects (as of J2SE 1.2).
  • Iterable – the interface that allows generic iteration using the enhanced for loop (as of J2SE 5.0).
  • security policies.
  • square root (StrictMath as of J2SE 1.3).
  • The primitive wrapper classes that encapsulate primitive types as objects.
  • The basic exception classes thrown for language-level and other common exceptions.

Classes in java.lang are automatically imported into every source file.

java.lang.ref

The 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 an expressive system of references and allows for special behavior for garbage collection. A normal reference in Java is known as a "strong reference." The java.lang.ref package defines three other types of references — soft, weak, and phantom references. Each type of reference is designed for a specific use.

  • 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 are only garbage collected when free memory is low—but again, this is at the garbage collector's discretion. Semantically, a soft reference means, "Keep this object when nothing else references it, unless the memory is needed."
  • A string intern pool. Semantically, a weak reference means "get rid of this object when nothing else references it at the next garbage collection."
  • A 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 clear() method to clear the reference.

The java.lang.ref also defines the class ReferenceQueue, which can be used in each of the applications discussed above to keep track of objects that have changed reference type. When a Reference is created it is optionally registered with a reference queue. The application polls the reference queue to get references that have changed reachability state.

java.lang.reflect

Reflection is a constituent of the JavaBeans that 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 metadata that the JVM has about the program.

Techniques

There are two basic techniques involved in reflection:

  • Discovery - this 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

Discovery typically starts with an object and calling the Object.getClass() method to get the object's Class. The Class object has several methods for discovering the contents of the class, for example:

  • Method objects representing all the public methods of the class or interface
  • Constructor objects representing all the public constructors of the class
  • Field objects representing all the public fields of the class or interface
  • inner classes) of the class or interface
  • getSuperclass() – return the Class object representing the superclass of the class or interface (null is returned for interfaces)
  • getInterfaces() – returns an array of Class objects representing all the interfaces that are implemented by the class or interface
Use by name

The Class object 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. Class.forName("mypackage.MyClass")). With a Class object, member Method, Constructor, or Field objects can be obtained using the symbolic name of the member. For example:

  • getMethod("methodName", Class...) – returns the Method object representing the public method with the name "methodName" of the class or interface that accepts the parameters specified by the Class... parameters.
  • getConstructor(Class...) – returns the Constructor object representing the public constructor of the class that accepts the parameters specified by the Class... parameters.
  • getField("fieldName") – returns the Field object representing the public field with the name "fieldName" of the class or interface.

Method, Constructor, and Field objects can be used to dynamically access the represented member of the class. For example:

  • Field.get(Object) – returns an Object containing the value of the field from the instance of the object passed to get(). (If the Field object represents a static field then the Object parameter is ignored and may be null.)
  • static method then the first Object parameter is ignored and may be null.)
  • newInstance().)
Arrays and proxies

The java.lang.reflect package also provides an Proxy class that supports dynamic creation of proxy classes that implement specified interfaces.

The implementation of a Proxy class is provided by a supplied object that implements the []) invoke(Object, Method, Object[]) method is called for each method invoked on the proxy object—the first parameter is the proxy object, the second parameter is the Method object 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 Object result that contains the result returned to the code that called the proxy interface method.

java.io

The file system.

Streams

The stream classes follow the decorator pattern by 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 pattern XxxStreamType where Xxx is the name describing the feature and StreamType is one of InputStream, OutputStream, Reader, or Writer.

The following table shows the sources/destinations supported directly by the java.io package:

Source/Destination Name Stream types In/Out Classes
byte array (byte[]) ByteArray byte in, out ByteArrayOutputStream
char array (char[]) CharArray char in, out CharArrayWriter
file File byte, char in, out FileWriter
string (StringBuffer) String char in, out StringWriter
thread (Thread) Piped byte, char in, out PipedWriter

Other standard library packages provide stream implementations for other destinations, such as the InputStream returned by the java.net.Socket.getInputStream() method or the Java EE /javax/servlet/ServletOutputStream.html javax.servlet.ServletOutputStream] class.

Data type handling and processing or filtering of stream data is accomplished through stream FilterWriter.

The Reader and Writer classes are really just byte streams with additional processing performed on the data stream to convert the bytes to characters. They use the default OutputStreamWriter class converts an OutputStream to a Writer. Both these classes have constructors that support specifying the character encoding to use. If no encoding is specified, the program uses the default encoding for the platform.

The following table shows the other processes and filters that the java.io package directly supports. All these classes extend the corresponding Filter class.

Operation Name Stream types In/Out Classes
buffering Buffered byte, char in, out BufferedWriter
"push back" last value read Pushback byte, char in PushbackReader
read/write primitive types Data byte in, out DataOutputStream
object serialization (read/write objects) Object byte in, out ObjectOutputStream

Random access

The getFilePointer() method.

File system

The file attributes such as read-only and last modified timestamp. File objects that represent directories can be used to get a list of all the contained files and directories.

The network socket. FileDescriptor objects are used to create File streams. They are obtained from File streams and java.net sockets and datagram sockets.

java.nio

Main article: New I/O

In J2SE 1.4, the package 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.channels package also provides support for fine-grained locking of files.

java.math

The multiprecision arithmetic (including modular arithmetic operations) and provides multiprecision prime number generators used for cryptographic key generation. The main classes of the package are:

  • BigDecimal – provides arbitrary-precision signed decimal numbers. BigDecimal gives the user control over rounding behavior through RoundingMode.
  • bit manipulation, and other miscellaneous operations.
  • MathContext – encapsulate the context settings that describe certain rules for numerical operators.
  • RoundingMode – an enumeration that provides eight rounding behaviors.

java.net

The HTTP requests, as well as other common transactions.

java.text

The java.text package implements parsing routines for strings and supports various human-readable languages and locale-specific parsing.

java.util

Collections API, an organized data structure hierarchy influenced heavily by the design patterns considerations.

Special purpose packages

java.applet

Main article: Java applet

Created to support certificate authorities.

java.beans

Main article: JavaBeans

Included in the JavaBeans architecture. The architecture provides mechanisms for manipulating properties of components and firing events when those properties change.

The APIs in java.beans are 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.

java.awt

The system tray on supporting systems. This package, along with javax.swing contains the largest number of enums (7 in all) in JDK 6.

java.rmi

The JVMs.

java.security

Support for security, including the message digest algorithm, is included in the java.security package.

java.sql

An implementation of the java.sql package.

javax.rmi

Main article: RMI-IIOP

The javax.rmi package provides the support for the remote communication between applications, using the RMI over IIOP protocol. This protocol combines RMI and CORBA features.

Java SE Core Technologies - CORBA / RMI-IIOP

javax.swing

Main article: Swing (Java)

operating system GUI support.

This package contains the largest number of classes (133 in all) in JDK 6. This package, along with java.awt also contains the largest number of enums (7 in all) in JDK 6. It supports 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-controller pattern, 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.

javax.swing.text.html.parser

The javax.swing.text.html.parser package provides the error tolerant HTML parser that is used for writing various web browsers and web bots.

javax.xml.bind.annotation

The javax.xml.bind.annotation package contains the largest number of Annotation Types (30 in all) in JDK 6. It defines annotations for customizing Java program elements to XML Schema mapping.

OMG packages

org.omg.CORBA

Main article: CORBA

The RMI-IIOP, this package is for calling remote methods of objects on other virtual machines (usually via network).

This package contains the largest number of Exception classes (45 in all) in JDK 6. From all communication possibilities CORBA is portable between various languages; however, with this comes more complexity.

org.omg.PortableInterceptor

The org.omg.PortableInterceptor package contains the largest number of interfaces (39 in all) in JDK 6. It provides a mechanism to register ORB hooks through which ORB services intercept the normal flow of execution of the ORB.

Critical security issues with the Java SE plugin

Several critical security vulnerabilities have been reported, the most recent in January 2013.[5][6] Security alerts from Oracle announce critical security-related patches to Java SE.[7]

References

External links

  • Oracle Technology Network's Java SE
  • Java SE 7 API Javadocs
  • Java SE API documentation
  • JSR 270 (Java SE 6)
  • 1.8
  • 1.7
  • 1.6

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.