The Java™ Tutorials
Hide TOC
Deploying an Applet
Trail: Deployment
Lesson: Deployment In-Depth
Section: Deployment Toolkit

Deploying an Applet

You can deploy applets by using the runApplet function of the Deployment Toolkit script. The runApplet function ensures that the required minimum version of the Java Runtime Environment (JRE) software exists on the client and then runs the applet. The runApplet function generates an HTML <applet> tag with the information provided.

Note: Depending on the type of browser, you might be unable to view the HTML generated by the Deployment Toolkit script when you try to view the source for the web page. To view the generated HTML, try saving the HTML page after it has been loaded, or use a tool such as Firebug (a Mozilla Firefox add-on).

You can deploy applets by specifying the deployment options as attributes and parameters of the <applet> tag. You can also specify deployment options in a Java Network Launch Protocol (JNLP) file to take advantage of advanced features. See the Java Network Launch Protocol topic for more information about this protocol.


If the client does not have the required minimum version of the JRE software, the Deployment Toolkit script redirects the browser to to allow users to download the latest JRE software. On some platforms, users might be redirected before they can view the web page containing the applet.

The parameters to the runApplet function vary depending on whether you are using JNLP. Applets deployed by using JNLP can run only if the next generation Java Plug-in software exists on the client machine (the next generation Java Plug-in software was introduced in the Java Platform, Standard Edition 6 update 10 release).

The next section shows how to use the runApplet function in the HTML page that will display the applet. The following usage scenarios are described:

Function signature: runApplet: function(attributes, parameters, minimumVersion)



The following guidelines are helpful if some deployment options have different values in the attribute name-value pairs and in the JNLP file:

Open DeployUsingNameValuePairsAndJNLP.html in a browser to view the Java2D applet.

Note:  If you don't see the applet running, you need to install at least the Java SE Development Kit (JDK) 7 release.

Download source code for the Run Applet example to experiment further.

Previous page: Deployment Toolkit
Next page: Embedding JNLP File in Applet Tag