Ethan Nicholas of Sun has posted an article on Java 6 update 10 which just came out in beta to play.
For Java folk there are some huge wins, and for the first time in ages the Java applet has huge changes. If Java Applets can get past the sniggering baggage, there is actually interesting things to see there.
What was the pain again?
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 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 7!
And the solutions?
Java Kernel
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.
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.
Next-Generation Java Plug-In
Java 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:
JAVASCRIPT:
-
-
<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>
-
Also note, that with this version you can take a running Applet in the browser, pull it OUT of the page, close the browser, and see the applet still running (since it runs in a different process). This is very cool indeed.
Add to all of this the easy bridge between Java and JavaScript, and there are interesting opportunities.