Auto Downloading JREs using Java[TM] Web Start and Java[TM] Plug-in.


There are two forms of auto-download. The first form of auto-download comes into play when developers setup a web page to deploy an applet or JNLP application. This is described here:

        http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/launch.html

This form of auto-download takes advantage of a feature designed for the Java Plug-in on Internet Explorer. (I will refer to this form as plugin auto-download.) The plugin auto-download gives web designers a template for deploying applets and JNLP application. This template uses various scripts to detect a user's platform and browser types, and whether or not Java is already installed. Because some of the functionality outlined in this template uses VBScript and ActiveX controls, the full functionality of the plugin auto-download is currently limited to Internet Explorer on Windows.

* For every FCS release of Java, the plugin auto-download is generally available 2 weeks after the initial release is made public on java.sun.com.

* If you know that all your users will use Internet Explorer to launch your JNLP application for the first time, you can modify the plugin auto-download method to install a specific version of Java. To do this, add code to the VBScript to check for the version of Java you want, and redirect any users that do not have it.

The second form of auto-download occurs when a JNLP application specifies a version of Java in the j2se element. (I will refer to this form as JavaWS auto-download.) The j2se element is described here:

        http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html#resources

The j2se element allows the JNLP developer to require a specific version of Java. When JavaWS runs a JNLP application, if that app requests a version that is not installed, then JavaWS will try to auto-download the version.

Developers can specify either a general platform version, or a more specific product version. JavaWS knows how to auto-download all the platform versions of Java currently supported by Sun, i.e. 1.3, 1.4, and 1.5. When a platform version of Java is specified, JavaWS will get the most up to date version of that platform that it has available from Sun. JRE 1.5.0_02 is currently the most recent version of Java available for JavaWS auto-download.

If the j2se element specifies a product version, then it must also specify a download source. In this case, JavaWS checks to see if there is an installed version that meets the version requirement, and is from the specified source. If nothing meets these two conditions, JavaWS will attempt to auto-download Java from the source provided in the first j2se element.

OK, so how do make another version of Java available to my users?!?

Sometimes there are reasons why a developer will need provide Java from their own server. Sometimes this is because of various enterprise requirements. For example, all your users might be limited to accessing the companies internal network. Other times it might be because Sun hasn't made what you want available as soon as you need it. Whatever your reason, there is a solution.

Since 1.5.0, the JDK includes sample code that allows developers to deploy any version of Java for JavaWS auto-download from their own servers. This process is described in:
    <jdk-installdir>/sample/jnlp/jreinstaller/README

Where <jdk-installdir> is the location where you installed JDK 1.5.0+.

After you've set this up, it works pretty much the same way as the regular JavaWS auto-download. You specify the version you want, and for the source, you specify your own server. There is one main distinction. If you want your users to be able to download Java from either your server or Sun, then you must specify two separate j2se elements, and the first one must specify your server. For example:
    <j2se href="http://my.server.com/j2se" version="1.5.0_06+" />
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.5.0_06+" />

If you only specify your server, JavaWS will auto-download the version from your server even if there is an acceptable version from Sun already installed.

Why?

JavaWS will attempt to auto-download Java if there isn't a Java version already installed that meets the product version requirement and comes from the specified source. When Java is installed on the system, it registers its product version and source with JavaWS. When Sun Java is manually installed on the system, it registers its source as "http://java.sun.com/products/autodl/j2se". However, any version that is auto-downloaded is registered as coming from the source specified in the JNLP file. This is done for security, since JavaWS has no way to verify the specified version is a genuine Sun Java unless it actually comes from the Sun source.

By specifying both j2se elements, you let JavaWS know that any version that meets either specification is acceptable. When nothing is installed that meets either specification, then JavaWS will attempt to auto-download only from the source in the first specification. This is why your server must be listed first. (If you purposefully want to limit users to your server, then you only need the first tag.)


----------------------


I know there are people that want to know why every version of Java isn't available in every form the moment that any given version is released. Trust me when I say, we know of your pain, and we are doing what we can to alleviate it.

Q: Why is plugin auto-download available for every release, but JavaWS auto-download is piecemeal?

A:
Plugin auto-download is currently limited to Internet Explorer on Windows. It takes advantage of capabilities that basically come free to Sun because they use Windows CAB files. Because of this, any Java version that is available for Windows can be made available for plugin auto-download simply by creating the web link.

Q: You just said plugin auto-download available for every release, but this list (http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/autodl-files.html) says 5.0 is available up to update 3. What the #&%$?

A: Generally speaking plugin auto-download becomes available two weeks after it is first released on java.sun.com. This list is hand generated, and it is just out-of-date. Hopefully it will be up-to-date again soon. ;-)

Q: Why doesn't Sun make the different download types and download locations available at the same time?

A: This decision is primarily based on bandwidth assumptions. Some of these assumptions are outdated, and changes are being investigated, but turning the elephant around can take time.

Q: What's being done to improve the availability of JavaWS auto-download?

A: Work is being done on a tool that will automatically generate the files and links from the regular release files. This is fairly complex, so it will need some extensive testing before it is made public, but it is being looked into.

Q: Why is plugin auto-download limited to Internet Explorer on Windows? (Firefox rulz!!!)

A: Work is being done on a new deployment toolkit. Aside from that statement, I can't say much more right now, but at least know that Sun is aware of the existing limitations and working on a solution. Pay attention to the forums for more updates in the future.