Overview
Desktop clients have a wide variety of Java Platforms installed,
from the Microsft VM to Sun's latest Java SE 6 updates. They run various
operating systems from Sun, Microsoft, Apple, Red Hat, and others,
and are connected to the internet at a wide range of connection
speeds. How are content providers to deliver Java content to all of
these clients with the best possible user experience?
Various sources have published JavaScript techniques for detecting and
deploying the Java Platform for use by Java Plug-In applets and Java Web Start
applications. These scripts generally have serious limitations and
fail to support the varied combinations of browser, OS, and
configuration options found on today's clients.
The Java Deployment Toolkit allows developers to easily deploy applets and
applications to a large variety of clients with JavaScripts. It also provides
advice on using some of the most powerful features available in Java
Web Start and Java Plug-In, and an outline of the differences between
these two deployment vehicles.
Usage
The JavaScript (deployJava.js
) documented below makes it possible to automatically install Java Platform for
Java Plug-in applets and Java Web Start applications. The script exposes a
single object, named deployJava, which contains the following public
functions:
- getJREs() - Returns a list of currently-installed Java Platform
versions.
- installLatestJRE() - Triggers the installation of the
latest Java Platform.
- installJRE(requestVersion) - Triggers request version of Java Platform
to be installed. However, if DT plugin is not installed. It will only
install the latest Java Platform.
- runApplet(attributes, parameters, minimumVersion) - run an
applet with specified minimum version. Note that the version wildcards
(* and +) are not supported.
- writeAppletTag(attributes, parameters) - Write Applet tag to
your page. Note that this function should only be called while the page
is being rendered and should not be used after the page is completed.
- versionCheck(versionPattern) - Returns true if there's a
matching Java Platform version installed
- isWebStartInstalled(minimumVersion) - Returns true if at
least the minimum version of Java Web Start is installed
- createWebStartLaunchButton(jnlp, minimumVersion) - Create an
image button to launch the specified JNLP app.
- launch(jnlp) - Launch the JNLP app with plugin if avaialble
- isPluginInstalled() - Returns true if the ActiveX or XPI
plugin is installed.
When you use the above deployJava object, you need to specify the script source
to
http://java.com/js/deployJava.js
. Please refer to
deployJava.js
for documentations.
Note: For good deployment practice and advise, please refer to the
Deployment Advice
.
Feedback
Please provide us feedback or send us your questions to the
JRE Installer &
Auto Update Forum.
Samples
-
To detect JREs installed on a system:
function detectJRE()
{
var list = deployJava.getJREs();
var result = "";
if (list.length == 0)
{
alert ('No Detectable Java Platforms are Installed');
}
else
{
result = list[0];
for (var i=1; i<list.length; i++) {
result += ", " + list[i];
}
alert("You have the following Java Platform(s) installed: \n" + result);
}
}
Click here to try the Java Platform detection
code above.
-
To install the latest Java Platform:
function install_latestJRE() {
deployJava.installLatestJRE();
}
Click here to try the
install function above.
If the latest Java Platform is not already installed, an installer will load and
install the latest Java Platform. Here's a screen shot of the installer:
- To access pre GA releases of Java SE (such as ea, beta and rc):
In normal operations, Java Deployment Toolkit will only install GA
(general availability) versions of Java SE.
An additional JavaScript
method, deployJava.setEarlyAccess() has been added to allow you to use
DT to install the kernel or online installer for 6u10.
In order to use this feature, you must set the JavaScript variable
earlyAccessURL to point to the early access installer you want it to
run.
For example, on windows, to install the 6u10 beta b14 online
installer:
deployJava.setEarlyAccess('true');
deployJava.EarlyAccessURL='http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-beta-b14/windows-i586/jre-6u10-beta-windows-i586-p-iftw.exe';
- To install the 6u10, beta b14 kernel installer:
function installEA() {
deployJava.setEarlyAccess('true');
deployJava.setInstallerType("kernel");
deployJava.EarlyAccessURL='http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-beta-b14/windows-i586/jre-6u10-beta-windows-i586-p-iftw-k.exe';
deployJava.installLatestJRE();
}
Then, user the deployJava.js functions as before, if installation of
the latest version is required, it will use this version.
Click here to install 6u10 Beta.
Uninstall Plugin
The Java Deployment Toolkit will not be uninstalled when 6u10 is uninstalled. To
uninstall the Java Deployment Toolkit plugin:
- Close all web browser instances
- Uninstall Java Platform
- Delete c:\windows\system32\deploytk.dll
- Except Internet Explorer, Mozilla and other browsers also require
to delete npdeploytk.dll from their plugin directories.
For Mozilla browsers, the DLL is located under
<Mozilla_or_Firefox_install_location>\plugins\npdeploytk.dll
(i.e. C:\Program Files\Mozilla Firefox\plugins\npdeploytk.dll).