The Java Plug-In has been around for years helping to bring Java to browsers. It has also brought along its share of headaches and frustrations for users and developers. Many consumers experienced browser incompatibility issues, browser freezing and even JVM crashes. However, a few weeks ago it was reported that Sun was rewriting the Java plug-in from the ground up to bring a product to developers and consumers which has been desired for a long time.

InfoQ recently interviewed Nicolas Lorain, the product manager for Java SE, and discussed the rewrite of the Java plug-in slated for Java SE 6 Update N.

What were the main issues with the existing Java Plug-In that warranted a complete rewrite?

Reliability, portability and functionality. The existing version of the Java Plug-in was developed "organically" over a period of several years, supporting different combinations of operating system and browser family. The complexity of the existing code base has resulted in some inconsistent behaviors across different browser families. This is particularly true for scripting support (Java/JavaScript interaction) across different browsers, making it difficult to write cross-browser applets that interacted with the surrounding web page. While this is by far not unique to Java scripting support, cross platform interoperability is something Sun takes seriously. Features available to Java Web Start applications such as JRE version selection and JVM command line argument specification, could not be supported in the previous Java Plug-in's architecture. A ground-up rewrite was necessary to make applets as powerful as applications launched via Java Web Start.

Sun will provide the new plug-in for Solaris, Linux and Windows which it directly supports. Apple will continue providing support for the Mac OS, however, Sun is collaborating closely. With the new plug-in being provided on the aforementioned operating systems Sun has been testing it with Internet Explorer 6, Internet Explorer 7 and Firefox 3 Alpha. InfoQ asked about the lack of support for the widely adopted Firefox 2,

Why not design the plug-in to work with the well-adopted Firefox 2 to begin with?

One of the major changes in the new Plug-in is how we interface with the Firefox browser. Due to historic reasons, the current Plug-in uses a complex, Java-specific interface called the OJI. In the new Plug-in we have switched to using the more industry-standard NPAPI and NPRuntime interfaces used by other browser Plug-ins. We found that there were a couple of minor API additions necessary to both the NPAPI and NPRuntime to support multithreaded plug-ins portably, and to support certain advanced JavaScript interoperability. These API additions are not Java-specific, but are needed by any suitably complex Plug-in. There are also some assumptions in the Firefox 2 code base that the Java Plug-in was implemented via the OJI that had to be changed to support an NPRuntime-based Java Plug-in. Additionally, we expect Firefox 3 to be available within a few months of the Java SE 6 Update N release, which means most Java and Firefox users will have upgraded to Java 6 Update N and Firefox 3 respectively within a short period of time. For these reasons, we've decided to first focus on the new Java Plug-in support on Firefox 3, while addressing Firefox 2 support in a second phase.

We do not have any announcements for explicit Safari or Opera support at this time, but given the fact that the new Plug-in is extremely easy to port, we do not expect this to be an issue overtime, although we cannot make any commitments on behalf of Apple with regards to the JRE for MacOS support for Safari.

Nicolas did mention that ports for other browsers such as Safari and Opera could be done rather easily,

The new plug-in will be shipped with the JRE starting with Java SE 6 Update N (aka 6uN), however, the new plug-in will be turned off by default. Therefore, end users will have to configure the plug-in (through Windows control panel or by changing a symlink on Unix platforms) to use the latest and greatest.



Finally, InfoQ wrapped the interview with Nicolas Lorain to find out why consumers would want to adopt the new plug-in,

Absolute reliability Better user experience: no more browser pauses as applets start up or shut down Robust support for advanced applet content incorporating 3D graphics and other features.

For additional information try visiting some of the following links: