|
By Ethan Nicholas, April 2008
|
|
|
Don't be fooled by its unassuming name: the upcoming Java SE 6 update 10 (currently in RC release) is a
very different animal than the updates that preceded it. Java SE 6u10 pushes
the envelope by adding more new features and functionality than in any previous
Java programming language update release, including many that have been a long time coming.
Officially, a "Java update release" is a release in which only the fourth
version number (the 10 in 1.6.0_10) changes. Unlike major releases, update
releases are not allowed to add, remove, or change any public APIs, and
generally this has limited update releases to only containing bug fixes. 6u10
likewise contains no new or changed public APIs -- but despite that restriction,
we still managed to squeeze in some incredible new features.
Why A Special Update Release?
Once a Java program is up and running, it's generally smooth sailing.
Modern Java Runtime Environments (JREs) are stable, reliable, and fast.
Unfortunately, getting to the "up and running" part has historically been
more difficult than it should be. Challenges have included:
- Difficult to detect JREs, especially from a web browser
- Difficult to automatically install new JREs
- Large download size
- Poor cold start performance
- Little overlap between applets and Web Start programs
Java SE 6u10 was created as a response to these challenges. By carefully
avoiding public API changes, we can get the fixes into your hands sooner --
no need to wait for Java SE 7!
Java Kernel
The JRE provides many different APIs: Swing,
AWT, ImageIO, SQL, CORBA, RMI, math, XML, XSLT, concurrency... too many to
name, and each new release adds more. While the variety of APIs makes it
easy to write Java software, it's no coincidence that the JRE has been getting
steadily bigger over the years (Java 2 Platform, Standard Edition 1.5 was a smaller download due to better
compression; the uncompressed JRE was still bigger).
Java Kernel is a new distribution aimed at getting Java software up and running
faster. Instead of a full JRE, users download a small installer (the "kernel")
which includes the most commonly needed JRE components. Additional components
are downloaded as needed, and the JRE will download remaining components in the
background and then reassemble itself.
Figure 2: Kernel Size in MB
In the current build, the typical download size for Swing programs and Java
applets is on the order of 4-5MB, compared to 14.4MB for the full JRE.
More information about Java Kernel can be found in the 6u10 FAQ.
Next-Generation Java Plug-In
Java SE 6u10 includes a brand-new implementation of the Java Plug-in, which is
used by default as long as you are using Firefox 3 or Internet Explorer. The
next-generation plug-in runs applets outside of the browser in one or more
separate processes. Applets still appear inside of the web browser window as
they always have, but this means that it is now possible to use different JRE
versions, command-line arguments, and configurations to run different applets.
The isolation provided by running the web browser and the JRE -- two very large,
very complex pieces of software -- in separate process spaces improves the
reliability of both, and gives applets the same flexibility and control over JRE
configurations that other Java software has always enjoyed.
Since applets now feature the same powerful JRE selection and configuration
that Java Web Start programs do, it was only natural to use the same mechanism
for both. The Java Plug-In now supports using Java
Network Launching Protocol (JNLP) files to specify applet configuration and
startup options. With very little additional work, you can now deploy the same
program as both an applet and a Web Start program, and still take advantage of
JNLP services such as PersistanceService and
FileSaveService.
New Plug-In Advantages:
- Improved reliability
- Improved JavaScript communication
- Per-applet control of JRE command-line arguments
- Per-applet control of JRE memory settings, larger maximum heaps
- JNLP support
- Per-applet JRE version selection
- Improved Vista support
Much more information about the new plug-in can be found in the release notes.
Java Deployment Toolkit
The Java Deployment Toolkit makes deploying Java applets or Java Web Start
programs a snap. The Deployment
Toolkit JavaScript file provides:
- Accurate detection of installed JREs
- Seamless JRE installation
- Complete applet launching (JRE detection and, if necessary, upgrading)
in a single line of code
- Complete Web Start program launching in a single line of code
The following HTML code is all it takes to ensure that Java 1.6 is installed and
then a Java applet is launched:
<script src="http://java.com/js/deployJava.js"></script>
<script>
deployJava.runApplet({codebase:"http://www.example.com/applets/",
archive:"ExampleApplet.jar", code:"Main.class",
width:"320", Height:"400"}, null, "1.6");
</script>
More documentation about the deployment toolkit can be found here.
Nimbus Look and Feel
When the venerable Metal
look and feel for Swing first debuted, its main aesthetic
competition was the Windows
95 interface. Given the state of graphical user interfaces a decade
ago, Metal was an attractive and elegant alternative to the other common
interfaces of the time.
The updated Ocean
theme in Java SE 5 helped to keep Metal a viable choice up to the
present day, but it's time for Swing's cross-platform look and feel to get an
overhaul.
Enter the Nimbus Look and Feel. A
brand new, modern look and feel based on Synth, Nimbus provides a
polished look to applications which choose to use it. And because Nimbus is
drawn entirely using Java 2D vector graphics, rather than static bitmaps, it's
tiny (only 56KB!) and can be rendered at arbitrary resolutions.
Figure 3: SwingSet3 in Metal
Figure 4: SwingSet3 in Nimbus
For compatibility reasons, Metal is still the default Swing look and feel, but
updating applications to use Nimbus couldn't be simpler. It only takes a single
line of code:
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
You can also force Nimbus to be the default look and feel by specifying
-Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel.
on the command line. A more permanent way to set the property is to add
swing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
to the file <JAVA_HOME>/lib/swing.properties. You will have to create
the swing.properties file if it does not already exist.
For further reading about Nimbus, take a look at the Nimbus early
access page.
Sun's JRE has been steadily getting faster over the years, and 6u10 is no
exception. Key performance improvements are the introduction of Java Quick
Starter, which will substantially improve Java cold start time on most systems,
and a new graphics pipeline on Windows.
The new graphics pipeline will use Direct3D to accelerate most common
operations, so the powerful 3D graphics card you probably have in your computer
will have a use other than playing games. Translucency, gradients, affine
transforms, antialiasing, rectangular fills and copies, and various other
graphics operations will all be accelerated by 3D graphics cards. And, unlike
previous 3D pipelines which were not robust enough to be enabled by default, the
new pipeline is rock-solid and used by default in 6u10.
Read more about these features in Chet Haase's blog.
Improved Patching
Java SE 6u10 includes improvements to patch downloading and installation. Of
course this won't be visible until 6u11 shows up, but at that point the
update will be downloaded by our new download engine, which monitors your
network usage and throttles its bandwidth usage back to avoid interfering
with your Internet usage.
The new download engine automatically resumes interrupted downloads, and
6u10 uses a new patching algorithm which will significantly reduce the size
of future updates. Unlike current JREs, which prompt you as soon as an
update becomes available and then make you wait during the download, 6u10
will download the patch in the background and only prompt for your
permission to install when the download is already complete.
Deployment Usability
Java Web Start has always supported versioned downloads, and both applets
and Web Start have supported the use of Pack200
compression since it first appeared.
However, both of these features required server-side cooperation, which made
them inherently difficult to work with. Even though the required servlets
were provided and developers merely needed to install them, that unfortunately
is not an option with many web hosts and the features were not as widely used as
they might have been.
Starting in 6u10, both versioning and pack200 support are available without
any special server support. You still have to enable the feature in the JNLP
file or applet tag, but this is as easy as adding
<property name="jnlp.packEnabled" value=true">
or
<param name="java_arguments" value="-Djnlp.packEnabled=true">
Full documentation can be found here.
But Wait, There's More!
Like any Java update release, there are also a host of bugfixes, performance
improvements, and usability improvements -- more than we can cover in any one
article. Java SE 6u10 is the biggest update release (no public API changes) of
Java software we have ever shipped, and the fact that there are no public API changes
doesn't mean that you won't see anything to be excited about.
Download Java SE 6 Update 10 RC
For 6u10 JDK download, please visit the early access download page.
|