JDK for Solaris Developer's Guide

New Features and Enhancements

Version 1.5.0 of the Java Platform Standard Edition 5 is a major feature release. The features listed below are introduced in 1.5.0 since the previous major release (1.4.0).

For highlights of the new features, also see J2SE 1.5 in a Nutshell (at http://java.sun.com/developer/technicalArticles/releases/j2se15/). For issues, see the JDK 5.0 release notes (at http://java.sun.com/j2se/1.5.0/relnotes.html).

Performance Enhancements

For a synopsis of performance enhancements, see Performance Enhancements at http://java.sun.com/j2se/1.5.0/docs/guide/performance/speed.html.

Java Language Features

For more information see New Language Features at http://java.sun.com/j2se/1.5.0/docs/guide/language/index.html.

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 and to the generics documentation at http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html.

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 and to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html.

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 and to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html.

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 and to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html.

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 and to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html.

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 and to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html.

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 and to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html.

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, refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html.

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, refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html.

Server-Class Machine Detection

At application startup, the launcher can attempt to detect whether the application is running on a server-class machine. Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/vm/server-class.html.

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. Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/vm/thread-priorities.html.

Fatal Error Handling

The fatal error reporting mechanism has been enhanced to provide improved diagnostic output and reliability.

High-Precision Timing Support

The method System.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.

Core Libraries

Lang and Util Packages

For a synopsis of java.lang and java.util enhancements, refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/lang/enhancements.html.

Networking

For a synopsis of added networking features, refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/net/enhancements-1.5.0.html.

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 documentation at http://java.sun.com/j2se/1.5.0/docs/guide/security/index.html.

Internationalization

Enhancements are as follows:

Refer also to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/intl/index.html.

Improved Support for Environment Variables

The System.getenv(String) method is no longer deprecated. The new System.getenv() method allows access to the process environment as a Map<String,String>. Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#getenv(java.lang.String).

ProcessBuilder

The new ProcessBuilder 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). Refer also to the documentation at http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html.

Formatter

An interpreter for printf-style format strings, the Formatter 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 as byte, java.math.BigDecimal , and java.util.Calendar are supported. Limited formatting customization for arbitrary user types is provided through the java.util.Formattable interface.

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html.

Scanner

The java.util.Scanner class can be used to convert text into primitives or Strings. Since it is based on the java.util.regex package, it also offers a way to conduct regular expression based searches on streams, file data, strings, or implementors of the Readable interface. Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html.

Reflection

Support for generics, annotations, enums, and convenience methods has been added. Also, java.lang.Class has been generified. Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/reflection/enhancements.html.

JavaBeans Component Architecture

A subclass of PropertyChangeEvent called IndexedPropertyChangeEvent 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 the PropertyChangeSupport class to support firing indexed property change events. Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/beans/index.html.

Collections Framework

The Collections Framework has been enhanced in the following ways:

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/collections/index.html.

Java API for XML Processing (JAXP)

For details refer to JSR 206 or to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/xml/jaxp/index.html.

Bit Manipulation Operations

The wrapper classes (Integer, Long, Short, Byte, and Char) now support common bit manipulation operations which include highestOneBit, lowestOneBit, numberOfLeadingZeros, numberOfTrailingZeros, bitCount, rotateLeft, rotateRight, reverse, signum, and reverseBytes.

Math

The numerical functionality provided by the libraries has been augmented in several ways:

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/math/index.html.

Instrumentation

The new java.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 1.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.

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/serialization/index.html.

Concurrency Utilities

The java.util.concurrent, java.util.concurrent.atomic, and java.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 and to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/concurrency/index.html.

Threads

The java.lang.Thread class has the following enhancements:

Monitoring and Management

This release of J2SE offers significant enhancements for monitoring and management for the Java platform.

Integration Libraries

Remote Method Invocation (RMI)

RMI has been enhanced in the following areas:

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/rmi/index.html.

Java Database Connectivity (JDBC)

RowSet interface, part of the javax.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 a RowSet 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:

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/index.html.

CORBA, Java IDL and RMI-IIOP

Enhancements to CORBA, Java IDL, and Java RMI-IIOP are discussed in Changes in CORBA Features Between J2SE 1.4.x and 1.5.0. Refer to the Java IDL documentation at http://java.sun.com/j2se/1.5.0/docs/guide/idl/index.html and to the Java RMI-IIOP documentation at http://java.sun.com/j2se/1.5.0/docs/guide/rmi-iiop/index.html.

Java Naming and Directory InterfaceTM (JNDI)

JNDI provides the following new features.

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/jndi/index.html.

User Interface

Internationalization

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/intl/index.html.

Java Sound Technology

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/sound/index.html.

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).

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/2d/index.html.

Image I/O

The Image I/O system now has readers and writers for BMP and WBMP formats.

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/imageio/index.html.

AWT

Version 1.5.0 features many AWT enhancements and bug fixes, including some that have often been requested by our customers. Most notably, the new MouseInfo class makes it possible to determine the mouse location on the desktop. New Window methods make it possible to specify the default location for a newly created window (or frame), appropriate to the platform. Another Window 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 new DropTargetDragEvent API allows the drop target to access transfer data during the drag operation.

AWT http://java.sun.com/j2se/1.5.0/docs/guide/awt/index.html.

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 1.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().

Refer to the documentation at Swing http://java.sun.com/j2se/1.5.0/docs/guide/swing/index.html.

Deployment

General Deployment

Pack200, a new hyper-compression format for JAR files defined by JSR 200, can siginificantly 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, refer to http://java.sun.com/j2se/1.5.0/docs/guide/deployment/enhancements-1.5.0.html.

Java Web Start Deployment

For a synopsis of Java Web Start deployment features and enhancements, refer to http://java.sun.com/j2se/1.5.0/docs/guide/javaws/enhancements-1.5.0.html

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.

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/index.html.

Java Platform Debugger Architecture (JPDA)

JPDA itself has many new features, described in more detail on the JPDA enhancements page.

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/jpda/index.html.

Java Compiler (javac)

Compiler options include:

Refer to the man page documentation at http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html.

Javadoc Tool

See What's New in Javadoc 1.5.0 at http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/whatsnew-1.5.0.html.

Annotation 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.

Refer to the documentation at http://java.sun.com/j2se/1.5.0/docs/guide/apt/index.html.

OS & Hardware Platforms

Supported System Configurations

For more information, refer to http://java.sun.com/j2se/1.5.0/system-configurations.html.

64-Bit AMD Opteron Processors

With J2SE 5, AMD Opteron processors are supported by the server VM on Suse Linux and on Windows 2003.