Java Applets that "just work"
Summing up the results from prior post, getting Java Applets to "Just Work" in the browser boils down to a "to-do" list on the part of multiple parties.
Sun must offer a consistent API for downloading the appropriate JRE for the user's machine. This API should look like...
http://downloadserver.sun.com/downloads/jre to download the latest JRE. http://downloadserver.sun.com/downloads/jre?version=1.4 to download the latest 1.4 JRE. http://downloadserver.sun.com/downloads/jre?version=1.4.2 to download the latest 1.4.2 JRE. http://downloadserver.sun.com/downloads/jre?version=1.4.2_10 to download the latest 1.4.2_10 JRE.
Note that in each case the server can use browser detection to supply the appropriate binary for the browser and operating system.
Note also that the API **must never change** once offered. Also the default installation should be as silent as possible.
Firefox must provide a means to specify the minimum or exact Java version required. Right now we will have a failure every time an earlier Java version is installed on the user's machine than is required by the applet. A better solution would be for Firefox to look for a version= (or similar) attribute on APPLET, EMBED, and OBJECT tags. If the installed Java version is earlier than specified, then offer to install the appropriate Java version. The default would be to download from the above Sun URL, and could be overridden using a pluginurl= attribute (or similar). Note that the interpretation of the version= attribute should follow a similar scheme.
version=' ' or when unspecified accepts whatever Java version is installed on the machine, or offers to download the latest JRE. version='1.4' offers to download the latest 1.4 JRE if no or a non-1.4 version is installed on the machine. version='1.4+' offers to download the latest JRE if no or a version earlier than 1.4 is installed on the machine. version='1.4.2' offers to download the latest 1.4.2 JRE if no or a non-1.4.2 version is installed on the machine. version='1.4.2+' offers to download the latest JRE if no or a version earlier than 1.4.2 is installed on the machine. version='1.4.2_10' offers to download the latest 1.4.2_10 JRE if no or a non-1.4.2_10 version is installed on the machine. version='1.4.2_10+' offers to download the latest JRE if no or a version earlier than 1.4.2_10 is installed on the machine.
Note the use of "+" to distinguish between the need for a specific version, or for anything later than a specific version.
The JSP tag jsp:plugin should do browser detection (in the default case). For IE (to avoid getting the Microsoft JVM) the jsp:plugin tag should emit an OBJECT tag of the form:
The above assumes the Sun folks implement the suggested API. On all other platforms the jsp:plugin should emit an APPLET tag of the form:
Note that the **version=** attribute is currently ignored.
For the moment, the best we can do for dynamically generated pages is check the sort of browser, and for IE emit the OBJECT tag (as below), and for everything else emit the APPLET tag (as below).
Yes, I know the HTML 4 standard deprecates the APPLET tag. Pragmatically - this is irrelevant. Browsers for compatibility will have to support the APPLET tag ... forever. Given the current (and future) state of affairs, we would all be better off restoring the APPLET tag to future HTML standards, with the addition above.
Now - if I had unlimited free time (as if) - the right thing to do would be to ...
- Track down the folks at Sun responsible, and convince them to put up a consistent plugin-download API (as above).
- Work up and submit a patch to Mozilla/Firefox to implement the above APPLET semantic to download the appropriate plugin.
- Work up and submit a patch to JSP to get jsp:plugin to do the right thing (as above).
Right about now I can feel the appeal of accepting the Microsoft monoculture :).