当前页面:
在线文档首页 >
JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档
New Features - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档
|
Java Development Kit (JDKTM) Version 1.2 Summary of New Features
|
JDK 1.2 Contents
|
Version 1.2 of the Java Development Kit (JDKTM) adds the following major features
to the JavaTM platform and JDK tools since 1.1. The full list of features is
at Guide to Features. Also, to read the
story behind JDK 1.2 software and learn how people are using it it today, see
JDK 1.2 Feature
Articles.
- Java Platform
- Security Enhancements
- Swing (JFC)
- Java 2DTM (JFC)
- Accessibility (JFC)
- Drag & Drop (JFC)
- Application Services (JFC)
- Collections
- Extensions Framework
- JavaBeansTM Architecture Enhancements
- Input Method Framework
- Version Identification
- RMI Enhancements
- Serialization Enhancements
- Reference Objects
- Audio Enhancements
- JavaTM IDL
- JAR Enhancements
- JNI Enhancements
- Reflection Enhancements
- JDBCTM Enhancements
- Performance Enhancements
- Floating Point Changes
JavaTM Plug-In
- JavaTM Plug-In
Tool Support
- JavaTM Virtual Machine Debugger Interface
- JavaTM Virtual Machine Profiler Interface
Tools
- Command Line Changes from 1.1 to 1.2
- JDK Tools Changes
- JavaTM Compiler
- Javadoc Enhancements
- JavaTM Launcher
Java Platform
- Security Enhancements
- Policy-based, Easily-configurable, Fine-grained Access Control
introduces the concepts of "permission" and "policy."
When code is loaded, it is assigned "permissions" based on the
security policy currently in effect. Each permission specifies
a permitted access to a particular resource (such as "read" and
"write" access to a specified file or directory, "connect" access
to a given host and port, etc.). The policy, specifying which permissions
are available for code from various signers/locations, can be initialized
from an external configurable policy file. Unless
a permission is explicitly granted to code, it cannot access the resource
that is guarded by that permission.
These new concepts of permission and policy enable the
Java Development Kit to offer fine-grain, highly configurable,
flexible, and extensible
access control. Such access control can now not only be specified for
applets, but also for all code written in the Java programming
language, including applications, and beans.
- Certificate interfaces enable developers to build
tools for parsing certificates, enforcing their own
site-specific certificate policies, and managing local databases
of certificates.
- X.509 v3 implementation of the new, supported
certificate interfaces.
- The keytool, jar, jarsigner, and policytool security tools -
keytool creates key pairs and self-signed X.509 v1 certificates,
and manages keystores. Keys and certificates are used to digitally
sign your applications and applets. A keystore is
a protected database that holds keys and certificates.
jarsigner signs JAR (Java Archive Format) files,
and verifies the signature(s) of signed JAR files.
It accesses the keystore when
it needs to find the key when signing a JAR file. keytool and
jarsigner replace javakey. policytool creates and modifies
the external policy configuration files that define your installation's
security policy.
- Swing (JFC)
- Swing is a new set of GUI components with a "Pluggable look and
feel" that are implemented in 100% Pure JavaTM initiative, and based on the JDK 1.1
Lightweight UI Framework.
- Pluggable Look and Feel lets you easily assign an OS-specific
look & feel (Motif, Microsoft Windows, MacOS) or a uniform look & feel
(Java Look & Feel) to your Swing GUI components. Additionally,
you can modify an existing look & feel or create your own.
- Swing Components include both 100% Pure Java
versions of the 1.1 AWT component set, plus a rich set
of higher level components. The complete set includes borders,
buttons, checkboxes, combo boxes, icons, labels, lists,
list boxes, menus, menubars, menu items, popup menus,
radio buttons, progress bars, scroll panes & viewports,
scrollbars, tabbed panes, tables, text areas, text
components, text fields, trees and HTML viewers.
- Accessibility is built-in to Swing components. All Swing
components implement the Java Accessibility API.
- Mouseless operation support is built into the Swing components.
All Swing components can be operated entirely from the keyboard.
- Java 2D (JFC)
- Java 2D API is a set of classes for advanced 2D graphics
and imaging. It encompasses line art, text, and images in a
single comprehensive model. The API provides extensive
support for image compositing and alpha channel images, a set
of classes to provide accurate color space definition and
conversion, and a rich set of display-oriented imaging
operators. These classes are provided as additions to the
java.awt and java.awt.image packages (rather than as a separate
package).
- Accessibility (JFC)
- Accessibility API provides a clean interface which allows
assistive technologies to interact and communicate with JFC and
AWT components. Assistive technologies are used by people
with and without disabilities and include screen readers, screen
magnifiers, speech recognition, and keyboard support for mouseless
use. All Swing components implement this API.
- Drag & Drop (JFC)
- Drag & Drop enables data transfer both across
native applications and applications written in the Java
programming language, between Java applications, and
within a single Java application.
- Application Services (JFC)
- Keyboard Navigation makes it possible to substitute the
pressing of predetermined key combinations for mouse-driven events such as
the selection of a menu item or a dialog-box button.
- Multithreaded Event Queue is an enhanced event queue
that makes it easier for developers to synchronize events from
multiple sources. This simplifies thread management by making
use of new methods such as invokeLater(), which makes it possible
for an application to access the user interface from a
separate thread.
- Undo makes it possible to reverse the effects of a
previously executed command.
- Bounded Range Model sets limits on the values
that can vary with a bounded range, such as with sliders,
progress bars and scroll bars. It also corrects some shortcomings
of the AWT Adjustable interface.
- Custom Cursors allow programs to create their own
custom mouse cursors using arbitrary images. The hotspot can
also be defined.
- Debug Graphics Utility is a design tool that you can
use to test whether your Swing components are being drawn correctly.
With DebugGraphics, you can highlight component parts in bright
red as they are being drawn. Then you can monitor them as they
are being created and observe exactly how all drawing operations
are taking place.
- Repaint Batching is a mechanism that provides ways to
optimize the repainting of screen regions. It lets you mark a
component region as out-of-date, and compute the intersection of all
out-of-date regions and repaint what is appropriate. It also
provides a way for objects to be aware of all out-of-date
regions in a component hierarchy at a given time so advanced
optimization will be possible. Lastly, it allows you to plug
in a custom repaint batching system for special applications.
- Collections
- Collections Framework is a unified framework for representing
and manipulating collections, allowing them to be manipulated independently
of the details of their representation. It reduces programming effort,
increases performance, allows for interoperability among unrelated APIs,
reduces effort to design and learn new APIs, and fosters software
reuse. The framework includes interfaces, implementations, and algorithms.
- Extensions Framework
- Extension Framework supports the dynamic downloading and
installation of extensions as JAR files onto the Java platform. An
extension is a group of packages that implement an API that extends
the Java platform. Extensions will be available from both Sun and
from third parties. Standard extensions are special kinds of
extensions.
- JavaBeansTM Enhancements
- Interaction with Applet Semantics eases the development
of objects that implement Applet as well as JavaBeans architecture behavior.
- Better Design-Time Support adds infrastructure during
the JavaBeans component architecture design time to enable a more sophisticated
builder environment.
- Runtime Containment and Services Protocol (BeanContext)
adds additional context to the execution lifetime of JavaBeans
architecture including but not limited to AppletContext and the ability to
parent into an AWT presentation hierarchy.
- Input Method Framework
- Input Method Framework enables all text editing
components to receive Japanese, Chinese, or Korean text input
through input methods. An input method lets users enter
thousands of different characters using keyboards with far fewer
keys. Typically a sequence of several characters needs to be
typed and then converted to create one or more characters.
Components can actively use the API to support the on-the-spot
input style; otherwise the framework provides root-window style
input as a fallback.
- Version Identification
- Version Identification introduces package level version control
where applications and applets can identify at runtime the
version of a specific Java Runtime Environment, VM, and class
package.
- RMI Enhancements
- Remote Object Activation introduces support for
persistent references to remote objects and automatic object
activation via these references.
- Custom Socket Factories allow a remote object to specify the
custom socket factory that RMI will use for remote calls to that
object. RMI over a secure transport (such as SSL) can be
supported using custom socket factories.
- Minor API Enhancements allow the following: unexporting a
remote object, obtaining the stub for an object implementation,
and exporting an object on a specific port.
- Serialization Enhancements
- Serializable Fields API is added for defining and accessing
serializable fields. Enables separation of Serializable
class implementation from its serialized state.
- A serializable field is no longer required to be a
non-transient and non-static member of a serializable class.
Serializable fields of a class can be explicitly defined as
array components of the special class member
serialPersistentFields
.
- New interfaces
ObjectOutputStream.PutField
and
ObjectOutputStream.GetField
provide access to
a serializable field that is not declared as a field within
a Serializable class.
Enable a Serializable class to nominate a replacement for one of its
instances during serialization and/or deserialization by defining the
methods writeReplace
and readResolve
.
- New javadoc tags
@serial, @serialField
,
and
@serialData
provide a way to document the
Serialized Form of a Serializable class. The Javadoc
standard doclet generates a serialization specification based on the
contents of these tags.
- Reference Objects,
including weak references
- Reference Objects support a limited degree of
interaction with the garbage collector. A program may use
a reference object to maintain a reference to some other
object in such a way that the latter object may still be
reclaimed by the collector. A program may also arrange to
be notified some time after the collector has determined
that the reachability of a given object has changed.
- Audio Enhancements
- The Java Sound API Engine replaces the existing sound engine.
It enables playback of WAV, AIFF, AU, MIDI, and RMF files with
much higher sound quality. It introduces no new API.
- newAudioClip is a new static method in java.applet.Applet.
This method does not require an AppletContext, and thus enables
applications as well as applets to create AudioClips.
- Java IDL API
- Java IDL API adds CORBA (Common Object Request Broker Architecture)
capability to the Java platform, providing standards-based
interoperability and
connectivity. Java IDL enables distributed Web-enabled
applications to transparently invoke operations on remote
network services using the industry standard OMG IDL (Object
Management Group Interface Definition Language) and IIOP (Internet
Inter-ORB Protocol) defined by the Object Management Group.
Runtime components include a fully-compliant Java ORB for distributed
computing using IIOP communication. The
idltojava
compiler generates portable client stubs and server skeletons that
work with any CORBA-compliant ORB implementation.
- JAR Enhancements
- JAR Enhancements
extend the utility of the Java Archive format. Improvements
to the command-line JAR tool for creating and updating
signed JAR files. New standard APIs for reading and writing JAR files.
Policy and mechanism for handling dependencies on extensions
and other third-party libraries packaged as JAR files.
- JNI Enhancements
- JNI Enhancements extend
the Java Native Interface (JNI) to
incorporate new features in the Java platform. The
changes are driven by licensee and user comments.
- Reflection Enhancements
- Reflection Enhancements
enables a field, method or constructor object to be explicitly flagged
as suppressing default Java programming language access control.
- JDBC technology Enhancements
- JDBC Enhancements include JDBC 2.0. An
improved version of the JDBC-ODBC Bridge is an accessory to the
Java platform.
- Performance Enhancements
These performance enhancements are new in JDK 1.2 and are specific
to the Java Software reference implementation. In addition, the
floating point changes enable greater
efficiency for all implementations.
- Solaris Native Thread Support can provide
several advantages over the default threads package.
In a multi-processor environment, the Solaris kernel
can schedule native threads on the parallel processors
for increased performance.
The native threads VM can call into C libraries that use
Solaris native threads.
The VM can avoid some inefficient remapping of I/O system
calls that are otherwise necessary.
- Memory Compression for Loaded Classes
Constant strings are shared among different classes, resulting
in reduced memory consumption for applications written in
the Java programming language.
- Faster Memory Allocation and Garbage Collection
The thread-local heap cache eliminates the need of locking for
majority of heap allocations. Memory allocation speed is
drastically increased.
Garbage collection pauses are shorter. The garbage collector
no longer excessively consumes the C stack.
- Monitor Speedups
The thread-local monitor cache enables synchronized methods
to run closer to the speed of normal methods.
- Native Library JNI Port
Native libraries supporting core Java platform classes
(e.g., AWT) have
been rewritten using the Java Native Interface (JNI). The
resulting code is more efficient and can run unmodified on
different Java virtual machines.
- Just In Time (JIT) Compilers
JIT compilers are included with the Java Development Kit software
for both Windows and Solaris.
- RMI Performance Improvements
The client-side implementation of distributed garbage
collection (DGC) creates fewer network connections for its
communication, and it uses finer-grained locks to eliminate
a global synchronization bottleneck for each operation.
The server-side DGC uses the new weak reference and notification
facility to accurately and efficiently track the local
reachability of remote objects, eliminating the need for
costly linear searches of the remote object table.
RMI's dynamic class loading implementation has been optimized
in several ways, such as by eliminating redundant class
resolutions and object constructions.
The serialization performance of RMI's classes was increased
by adding explicit serialVersionUID fields to all serializable
classes (including generated stubs).
- Object Serialization Performance Improvements
Reduced heap allocation needed to serialize/deserialize.
Reduced initial heap allocation footprint for
ObjectOutputStream
and
ObjectInputStream
by making their tables more
dynamic and reducing their initial sizes.
Compressed storage needed for class descriptor within a
serialization stream by eliminating duplication of type strings.
Improved throughput when serializing a large number of distinct
objects to a stream.
- Floating Point Changes
- The Java programming language and virtual machine specifications
have been modified slightly to permit implementations to perform
floating point calculations more efficiently on popular
microprocessors. Some information can be found in the
JDK
Software Changes and Release notes
Java Plug-In
- Java Runtime Environment and Java Plug-In
- Java Plug-In software is a product that allows customers to direct Java
applets or JavaBeans components to run using Sun's Java Runtime Environment
(JRE), instead of the browser's default Java runtime environment.
Tool Support
- Java Virtual Machine Debugger Interface
- Java Virtual Machine Debugger Interface (JVMDI) is low-level
services for debugging provided by the Java virtual machine.
- Java Virtual Machine Profiler Interface
- Java Virtual Machine Profiler Interface (JVMPI) is an
experimental interface for profiling. The JVMPI is not
yet a standard profiling interface. This feature is provided
for the benefit of tools vendors who have an immediate need
for profiling hooks in the Java virtual machine.
The JVMPI will continue to evolve, based on feedback from
customers and tools vendors.
Tools
Several of the tools have improvements; some are listed here.
- Javadoc Enhancements
can be used to customize the content and format of the output
of the javadoc tool. The standard generated format of API
documentation has also changed dramatically.