Java 2 Platform Standard Edition 5.0 is a major feature release. The features listed below are introduced in 5.0 since the previous major release (1.4.0).For highlights of the new features, also see J2SETM 5.0 in a Nutshell. For issues, see JDK 5.0 release notes.
- Performance Enhancements
- Java Language Features
- Generics
- Enhanced for Loop
- Autoboxing/Unboxing
- Typesafe Enums
- Varargs
- Static Import
- Metadata (Annotations)
- Virtual Machine
- Class Data Sharing
- Garbage Collector Ergonomics
- Server-Class Machine Detection
- Thread Priority Changes
- Fatal Error Handling
- High-Precision Timing Support
- Base Libraries
- Lang and Util Packages
- Networking
- Security
- Internationalization
- Improved Support for Environment Variables
- ProcessBuilder
- Formatter
- Scanner
- Reflection
- JavaBeansTM Component Architecture
- Collections Framework
- Java API for XML Processing (JAXP)
- Bit Manipulation Operations
- Math
- Instrumentation
- Serialization
- Concurrency Utilities
- Threads
- Monitoring and Management
- Integration Libraries
- Remote Method Invocation (RMI)
- Java Database Connectivity (JDBC)
- CORBA, Java IDL, and Java RMI-IIOP
- Java Naming and Directory InterfaceTM (JNDI)
- User Interface
- Internationalization
- Java Sound Technology
- Java 2DTM Technology
- Image I/O
- AWT
- Swing
- Deployment
- General Deployment
- Java Web Start
- Tools and Tool Architecture
- Java Virtual Machine Tool Interface (JVMTI)
- Java Platform Debugger Architecture (JPDA)
- Java Compiler (javac)
- Javadoc Tool
- Annotation Processing Tool (
apt
)- Java TM 2 Platform, Standard Edition 5.0 Trouble-Shooting and Diagnostic Guide
- OS & Hardware Platforms
- Supported System Configurations
- 64-Bit AMD Opteron Processors
Performance Enhancements
For a synopsis of performance enhancements, see Performance Enhancements.
JavaTM Language Features
For more information see New Language Features.Generics
This long-awaited enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety. It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting. Refer to JSR 14.Enhanced for Loop
This new language construct eliminates the drudgery and error-proneness of iterators and index variables when iterating over collections and arrays. Refer to JSR 201 .Autoboxing/Unboxing
This facility eliminates the drudgery of manual conversion between primitive types (such as int) and wrapper types (such as Integer). Refer to JSR 201 .Typesafe Enums
This flexible object-oriented enumerated type facility allows you to create enumerated types with arbitrary methods and fields. It provides all the benefits of the Typesafe Enum pattern ("Effective Java," Item 21) without the verbosity and the error-proneness. Refer to JSR 201.Varargs
This facility eliminates the need for manually boxing up argument lists into an array when invoking methods that accept variable-length argument lists. Refer to JSR 201.Static Import
This facility lets you avoid qualifying static members with class names without the shortcomings of the "Constant Interface antipattern." Refer to JSR 201.Metadata (Annotations)
This language feature lets you avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a "declarative" programming style where the programmer says what should be done and tools emit the code to do it. Also it eliminates the need for maintaining "side files" that must be kept up to date with changes in source files. Instead the information can be maintained in the source file. Refer to JSR 175.
Virtual Machine
Class Data Sharing
The class data sharing feature is aimed at reducing application startup time and footprint. The installation process loads a set of classes from the system jar file into a private, internal representation, then dumps that representation to a "shared archive" file. During subsequent JVM invocations, the shared archive is memory-mapped in, saving the cost of loading those classes and allowing much of the JVM's metadata for these classes to be shared among multiple JVM processes. For more information, click the above link.Garbage Collector Ergonomics
The parallel collector has been enhanced to monitor and adapt to the memory needs of the application. You can specify performance goals for applications and the JVM will tune the size of the Java heap to meet those performance goals with the smallest application footprint consistent with those goals. The goal of this adaptive policy is to eliminate the need to tune command-line options to achieve the best performance. For a synopsis of garbage collection features, click the above link.Server-Class Machine Detection
At application startup, the launcher can attempt to detect whether the application is running on a "server-class" machine.Thread Priority Changes
Thread priority mapping has changed somewhat allowing Java threads and native threads that do not have explicitly set priorities to compete on an equal footing.Fatal Error Handling
The fatal error reporting mechanism has been enhanced to provide improved diagnostic output and reliability.High-Precision Timing Support
The methodSystem.nanoTime()
has been added, providing access to a nanosecond-granularity time source for relative time measurements. The actual precision of the time values returned by System.nanoTime() is platform-dependent.
Base Libraries
Lang and Util Packages
For a synopsis of java.lang and java.util enhancements, click the above link.Networking
For a synopsis of added networking features, click the above link.Security
This release of J2SE offers significant enhancements for security. It provides better support for security tokens, support for more security standards (SASL, OCSP, TSP), improvements for scalability (SSLEngine) and performance, plus many enhancements in the crypto and Java GSS areas. For details see the above link.Internationalization
Enhancements are as follows:
- Character handling is now based on version 4.0 of the Unicode standard. This affects the
Character
andString
classes in thejava.lang package
, the collation and bidirectional text analysis functionality in thejava.text package
, character classes in thejava.util.regex
package, and many other parts of the J2SE. As part of this upgrade, support for supplementary characters has been specified by the JSR 204 expert group and implemented throughout the J2SE. See the article Supplementary Characters in the Java Platform, the Java Specification Request 204, and theCharacter
class documentation for more information.- The DecimalFormat class has been enhanced to format and parse
BigDecimal
andBigInteger
values without loss of precision. Formatting of such values is enhanced automatically; parsing into BigDecimal needs to be enabled using thesetParseBigDecimal
method.- Vietnamese is now supported in all locale sensitive functionality in the
java.util
andjava.text
packages. See the Supported Locales document for complete information on supported locales and writing systems.Improved Support for Environment Variables
TheSystem.getenv(String)
method is no longer deprecated. The newSystem.getenv()
method allows access to the process environment as aMap
.ProcessBuilder
The newProcessBuilder
class provides a more convenient way to invoke subprocesses than does Runtime.exec. In particular, ProcessBuilder makes it easy to start a subprocess with a modified process environment (that is, one based on the parent's process environment, but with a few changes).Formatter
An interpreter for printf-style format strings, theFormatter
class provides support for layout justification and alignment, common formats for numeric, string, and date/time data, and locale-specific output. Common Java types such asbyte
,java.math.BigDecimal
, andjava.util.Calendar
are supported. Limited formatting customization for arbitrary user types is provided through thejava.util.Formattable
interface.Scanner
Thejava.util.Scanner
class can be used to convert text into primitives orString
s. Since it is based on thejava.util.regex
package, it also offers a way to conduct regular expression based searches on streams, file data, strings, or implementors of theReadable
interface.Reflection
Have added support for generics, annotations, enums and have added convenience methods. Also have generified the class java.lang.Class.JavaBeans Component Architecture
A subclass ofPropertyChangeEvent
calledIndexedPropertyChangeEvent
has been added to support bound properties that use an index to identify the part of the bean that changed. Also, methods have been added to thePropertyChangeSupport
class to support firing indexed property change events.Collections Framework
The Collections Framework has been enhanced in the following ways:
- Three new language features are targeted at collections: Generics, Enhanced
for
Loop, and Autoboxing.- Three new interfaces have been added to the framework (two of which are part of
java.util.concurrent
):Queue
,BlockingQueue
, andConcurrentMap
.- Two concrete implementations of
Queue
have been added, as well as one skeletal implementation.- Five blocking queue implementations have been added, and one
ConcurrentMap
implementation.- Special-purpose
Map
andSet
implementations are provided for use with typesafe enums.- Special-purpose copy-on-write
List
andSet
implementations have been added.- Wrapper implementations are provided to add dynamic type-safety for most collection interfaces.
- Several new algorithms are provided for manipulating collections.
- Methods are provided to compute hash codes and string representations for arrays.
Java API for XML Processing (JAXP)
Click the above link for details or refer to JSR 206.Bit Manipulation Operations
The wrapper classes (Integer
,Long
,Short
,Byte
, andChar
) now support common bit manipulation operations which includehighestOneBit
,lowestOneBit
,numberOfLeadingZeros
,numberOfTrailingZeros
,bitCount
,rotateLeft
,rotateRight
,reverse
,signum
, andreverseBytes
.Math
The numerical functionality provided by the libraries has been augmented in several ways:
- The
BigDecimal
class has added support for fixed-precision floating-point computation. Refer to JSR 13.- The
Math
andStrictMath
libraries include hyperbolic transcendental functions (sinh, cosh, tanh), cube root, base 10 logarithm, etc.- Hexadecimal floating-point support - To allow precise and predictable specification of particular floating-point values, hexadecimal notation can be used for floating-point literals and for string to floating-point conversion methods in
Float
andDouble
.Instrumentation
The newjava.lang.instrument
package provides services that allow Java programming agents to instrument programs running on the Java virtual machine. The intrumentation mechanism is modification of the bytecodes of methods.Serialization
Support has been added to handle enumerated types which are new in version 5.0. The rules for serializing an enum instance differ from those for serializing an "ordinary" serializable object: the serialized form of an enum instance consists only of its enum constant name, along with information identifying its base enum type. Deserialization behavior differs as well--the class information is used to find the appropriate enum class, and the Enum.valueOf method is called with that class and the received constant name in order to obtain the enum constant to return.Concurrency Utilities
Thejava.util.concurrent
,java.util.concurrent.atomic
, andjava.util.concurrent.locks
packages provide a powerful, extensible framework of high-performance, scalable, thread-safe building blocks for developing concurrent classes and applications, including thread pools, thread-safe collections, semaphores, a task scheduling framework, task synchronization utilities, atomic variables, and locks. The addition of these packages to the core class library frees the programmer from the need to craft these utilities by hand, in much the same manner that the Collections Framework did for data structures. Additionally, these packages provide low-level primitives for advanced concurrent programming which take advantage of concurrency support provided by the processor, enabling programmers to implement high-performance, highly scalable concurrent algorithms in the Java language to a degree not previously possible without resorting to native code. Refer to JSR 166 .Threads
Thejava.lang.Thread
class has the following enhancements:
- Thread priority handling has changed; see the above link for details.
Thread.State
enum class and the newgetState()
API are provided for querying the execution state of a thread.- The new thread dump API - the
getStackTrace
andgetAllStackTraces
methods in theThread
class - provides a programmatic way to obtain the stack trace of a thread or all threads.- The
uncaughtExceptionHandler
mechanism, previously available only through the ThreadGroup class, is now available directly through the Thread class.- A new form of the
sleep()
method is provided which allows for sleep times smaller than one millisecond.Monitoring and Management
This release of J2SE offers significant enhancements for monitoring and management for the Java platform. See the above link for details.
- Monitoring and management API for the Java virtual machine
The newjava.lang.management
package provides the interface for monitoring and managing the Java virtual machine.- Monitoring and management API for the logging facility
The newjava.util.logging.LoggingMXBean
interface is the management interface for the logging facility.- JMX instrumentation of the Java virtual machine
The Java virtual machine (JVM) has built-in instrumentation that enables you to monitor and manage it using JMX. You can easily start a JMX agent for monitoring and managing remote or local Java VMs instrumentation or of any application with JMX instrumentation. See Monitoring and Management Using JMX for details.- The SNMP agent publishes the standard MIB for the Java virtual machine instrumentation as defined by JSR 163. For more information, see SNMP Monitoring and Management.
- JavaTM Management Extensions
JMXTM API version 1.2 and the RMI connector of the JMX Remote API version 1.0 are included in J2SE 5 release. The JMX API allows you to instrument libraries and applications for monitoring and management. The RMI connector allows this instrumentation to be remotely accessible. See the JMX documentation for more details.
Integration Libraries
Remote Method Invocation (RMI)
RMI has been enhanced in the following areas:
- Dynamic Generation of Stub Classes - This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use the Java Remote Method Invocation (Java RMI) stub compiler, rmic, to pregenerate stub classes for remote objects. Note that rmic must still be used to pregenerate stub classes for remote objects that need to support clients running on earlier versions.
- Standard SSL/TLS Socket Factory Classes - This release adds standard Java RMI socket factory classes,
javax.rmi.ssl.SslRMIClientSocketFactory
andjavax.rmi.ssl.SslRMIServerSocketFactory
, which communicate over the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols using the Java Secure Socket Extension (JSSE).- Launching rmid or a Java RMI Server from inetd/xinetd - A new feature, provided by the
System.inheritedChannel
method, allows an application to obtain a channel (java.nio.channels.SocketChannel
orjava.nio.channels.ServerSocketChannel
, for example) inherited from the process that launched the virtual machine (VM). Such an inherited channel can be used to either service a single incoming connection (as withSocketChannel
) or accept multiple incoming connections (as withServerSocketChannel
). Therefore, Java networking applications launched by inetd (Solaris(tm) Operating System) or xinetd (Linux) can now obtain theSocketChannel
orServerSocketChannel
inherited from inetd/xinetd.Java Database Connectivity (JDBC)
RowSet
interface, part of thejavax.sql
package, introduced in J2SE version 1.4, provides a lightweight means of passing data between components.At this release, as an aid to developers, the
RowSet
interface has been implemented (as JSR 114) in five of the more common ways aRowSet
object can be used. These implementations provide a standard that developers are free to use as is or to extend.Following are the five standard implementations:
JdbcRowSet
- used to encapsulate a result set or a driver that is implemented to use JDBC technologyCachedRowSet
- disconnects from its data source and operates independently except when it is getting data from the data source or writing modified data back to the data source. This makes it a lightweight container for as much data as it can store in memory.FilteredRowSet
- extendsCachedRowSet
and is used to get a subset of dataJoinRowSet
- extendsCachedRowSet
and is used to get an SQLJOIN
of data from multipleRowSet
objectsWebRowSet
- extendsCachedRowSet
and is used for XML data. It describes tabular components in XML using a standardized XML schema.CORBA, Java IDL, and Java RMI-IIOP
Enhancements to CORBA, Java IDL, and Java RMI-IIOP are discussed in Changes in CORBA Features Between J2SE 1.4.x and 5.0.
Java Naming and Directory InterfaceTM (JNDI)
JNDI provides the following new features.
- Enhancements to javax.naming.NameClassPair to access the fullname from the directory/naming service
- Support for standard LDAP controls: Manage Referral Control, Paged Results Control and Sort Control
- Support for manipulation of LDAP names.
User Interface
Internationalization
- To render multilingual text, using logical fonts, 2D now takes advantage of installed host OS fonts for all supported writing systems. For example, if you run in a Thai locale environment, but have Korean fonts installed, both Thai and Korean are rendered. The J2RE now also automatically detects physical fonts that are installed into its lib/fonts/fallback directory and adds these physical fonts to all logical fonts for 2D rendering.
- AWT now uses the Unicode APIs on Windows 2000/XP. As a result, some of its components can handle text without being restricted by Windows locale settings. For example, AWT text components can accept and display text in the Devanagari writing system regardless of the Windows locale settings.
Java Sound Technology
- Ports are now available on all platforms (RFE 4782900).
- MIDI device i/o is now available on all platforms (RFE's 4812168, 4782924).
- Optimized direct audio access is implemented on all platforms (RFEs 4908240 and 4908879). It is enabled by default on systems which offer native mixing (i.e. Linux ALSA with hardware mixing, Solaris Mixer enabled, Windows DirectSound).
- The new real-time Sequencer works with all MIDI devices and allows unlimited Transmitters (RFE 4773012).
- The
sound.properties
configuration file allows choice of default devices (RFE 4776511). For details, seeMidiSystem
andAudioSystem
for details.- MidiDevices can query connected Receivers and Transmitters (RFE 4931387, methods MidiDevice.getReceiver and MidiDevice.getTransmitter).
AudioFormat
,AudioFileFormat
, andMidiFileFormat
now have properties that allow further description and qualification of the format (RFEs 4925767 and 4666845).- A set of ease-of-use methods allow easier retrieval of lines from AudioSystem (RFE 4896221).
- The Sequencer interface is extended with loop methods, for seamless looping of specific portions of a MIDI sequence (RFE 4204105).
- Java Sound no longer prevents the VM from exiting (bug 4735740).
Java 2DTM Technology
Added 2D features include expanded Linux and Solaris printer support, new methods for creating fonts from files and streams, and new methods related to VolatileImages and hardware acceleration of images. A number of internal changes to text rendering code greatly improve its robustness, performance, and scalability. Other performance work includes hardware-accelerated rendering using OpenGL (disabled by default).Image I/O
The Image I/O system now has readers and writers for BMP and WBMP formats.AWT
Version 5.0 features many AWT enhancements and bug fixes, including some that have often been requested by our customers. Most notably, the newMouseInfo
class makes it possible to determine the mouse location on the desktop. NewWindow
methods make it possible to specify the default location for a newly created window (or frame), appropriate to the platform. AnotherWindow
enhancement makes it possible to ensure that a window (or frame) is always on top. (This feature does not work for some window managers on Solaris/Linux.) In the area of data transfer, the newDropTargetDragEvent
API allows the drop target to access transfer data during the drag operation.Swing
With the 1.4.2 release we provided two new look and feels for Swing: XP and GTK. Rather than taking a break, in 5.0 we're providing two more look and feels: Synth, a skinnable look and feel, and Ocean, a new theme for Metal. Beyond look and feels, we've added printing support to JTable, which makes it trivial to get a beautiful printed copy of a JTable. Lastly, after seven years, we've made jFrame.add equivalent to jFrame.getContentPane().add().
Deployment
General Deployment
Pack200, a new hyper-compression format for JAR files defined by JSR 200, can significantly reduce the download size of JAR files used in Java Webstart applications and Java Plug-in applets.For a synopsis of general deployment features and enhancements, click the General Deployment link above.
Java Web Start Deployment
For a synopsis of Java Web Start deployment features and enhancements, click the above link.
Tools and Tool Architecture
Java Virtual Machine Tool Interface (JVMTI)
JVMTI is a new native programming interface for use by development and monitoring tools. It provides both a way to inspect the state and to control the execution of applications running in the Java virtual machine (VM). JVMTI is intended to provide a VM interface for the full breadth of tools that need access to VM state, including but not limited to: profiling, debugging, monitoring, thread analysis, and coverage analysis tools.JVMTI will replace the now deprecated JVMPI and JVMDI in the next major release of J2SE.
Java Platform Debugger Architecture (JPDA)
JPDA itself has many new features, described in more detail on the JPDA enhancements page.
- A read-only subset of JDI has been defined. This subset can be used on a debuggee in which no debug code can be executed (such as a core file or a process that is hung or was not started in debug mode). The subset allows creation of JDI connectors for use in debugging such debuggees.
- A service provider interface for connectors and transports allows debugger vendors, or even end users, to create their own JDI connectors and transports and plug them into the JPDA reference implementation. For example, a connector could be provided to use SSL to communicate between the debugger and debuggee.
- JDI supports the new language features (generics, enums, and varargs).
- The lowest layer of JPDA, the Java Virtual Machine Debugger Interface (JVMDI), has been deprecated and will be removed in the next major J2SE release. Replacing it is the Java Virtual Machine Tool Interface (JVMTI). This is a more general interface that allows profiling to be done as well as debugging. The current profiling interface, Java Virtual Machine Profiling Interface(JVMPI) is also deprecated and will be removed in the next major release.
- The JPDA reference implementation includes new JDI connectors that allow corefiles and hung processes to be debugged.
Java Compiler (javac)
Compiler options include:
-source 1.5
- Enable 1.5 specific language features to be used in source files. (-target 1.5
is implied.)-target 1.5
- Allow javac to use 1.5 specific features in the libraries and virtual machine.-Xlint
- Enable javac to produce warning messages about legal, but suspect and often problematic, program constructs. An example would be declaring a class that implementsSerializable
but does not define aserialVersionUID
.-d32
- Indicate a 32-bit Solaris or Linux platform.-d64
- Indicate a 64-bit Solaris or Linux platform.-target cldc1.0
- Generate class files suitable for use on VMs in Connected Limited Device Configuration (CLDC) version 1.0 and later. The compiler generates stack maps making the use of the preverifier unnecessary.New Programmatic Interface
The
com.sun.tools.javac.Main
class provides two static methods to invoke the compiler from a program. See the man page for details.Javadoc Tool
See What's New in Javadoc 5.0Annotation Processing Tool (
apt
)apt
is a new command-line utility for annotation processing. It includes a set of reflective APIs and supporting infrastructure to process program annotations.Java TM 2 Platform, Standard Edition 5.0 Trouble-Shooting and Diagnostic Guide
This guide provides descriptions of tools, options, and other items for use in analyzing problems. It contains suggestions about what to try before submitting a bug report and what data to collect for a report.
OS & Hardware Platforms
Supported System Configurations
For more information, click the above link.
64-Bit AMD Opteron Processors
With J2SE 5, AMD Opteron processors are supported by the server VM on Suse Linux and on Windows 2003
No comments:
Post a Comment