Note: You use the appletviewer
command to launch the AppletViewer and run applets outside of a web browser. Although available and supported in JDK 9, the Applet API is marked as deprecated in preparation for removal in a future release. Instead of applets, consider alternatives such as Java Web Start or self-contained applications.
Synopsis
appletviewer [options] url...
Description
The appletviewer
command connects to the documents or resources designated by url
and displays each applet referenced by the documents in its own AppletViewer window. If the documents referred to by url
don’t reference any applets with the OBJECT
, EMBED
, or APPLET
tag, then the appletviewer
command does nothing. The OBJECT
, EMBED
, and APPLET
tags are described in AppletViewer Tags.
The appletviewer
command requires encoded URLs according to the escaping mechanism defined in RFC2396. Only encoded URLs are supported. However, file names must be unencoded, as specified in RFC2396.
Note:
The appletviewer
command is intended for development purposes only.
Options for appletviewer
-encoding encoding-name
Specifies the input HTML file encoding name.
-Jjavaoption
Passes the string javaoption
as a single argument to the Java interpreter, which runs the AppletViewer. The argument shouldn’t contain spaces. Multiple argument words must all begin with the prefix -J
. This is useful for adjusting the compiler's execution environment or memory usage. Seejava command documentation for more information about JVM options.
The AppletViewer makes it possible to run a Java applet without using a browser.
The AppletViewer ignores any HTML that isn’t immediately relevant to launching an applet. However, it recognizes a wide variety of applet-launching syntax. The HTML code that the AppletViewer recognizes is described in this section. All other HTML code is ignored.
object
The object
tag is the HTML 4.0 tag for embedding applets and multmedia objects into an HTML page. It’s also an Internet Explorer 4.n extension to HTML 3.2 which enables IE to run a Java applet using the latest Java plug-in.
<object width="pixelWidth" height="pixelHeight" > <param name="code" value="yourClass.class"> <param name="object" value="serializedObjectOrJavaBean"> <param name="codebase" value="classFileDirectory"> ...alternate-text </object>
Note:
The AppletViewer ignores the classID
attribute, on the assumption that it’spointing to the Java plug-in, with the value:
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
The AppletViewer also ignores the codebase
attribute that’s usually included as part of the object
tag, assuming that it points to a Java plug-in in a network cab file with a value like:
codebase="http://java.sun.com/products/plugin/1.1/jinstall-11-win32.cab#Version=1,1,0,0"
The optional codebase
parameter tag supplies a relative URL that specifies the location of the applet class.
Either code or object is specified, not both.
The type
parameter tag isn’t used by AppletViewer, but should be present so that browsers load the plug-in properly. For an applet, the value should be similar to:
<param name="type" value="application/x-java-applet;version=1.1">
or
<param name="type__1" value="application/x-java-applet">
For a serialized object or JavaBean, the type
parameter value should be similar to:
<param name="type__2" value="application/x-java-bean;version=1.1">
or
<param name="type__3" value="application/x-java-bean">
Other parameter tags are argument values supplied to the applet.
The object
tag recognized by IE4.n and the embed tag recognized by Netscape 4.n can be combined so that an applet can use the latest Java plug-in, regardless of the browser that downloads the applet.
The AppletViewer doesn’t recognize the java_code
, java_codebase
, java_object
, or java_type param
tags. These tags are needed only when the applet defines parameters with the names code
, codebase
, object
, or type
, respectively. In that situation, the plug-in recognizes and uses the java_ version
option in preference to the version is be used by the applet. If the applet requires a parameter with one of these four names, then it might not run in the AppletViewer.
embed
The embed
tag is the Netscape extension to HTML 3.2 that allows embedding an applet or a multimedia object in an HTML page. It allows a Netscape 4.n browser (which supports HTML 3.2) to run a Java applet using the Java plug-in.
<embed code="yourClass.class" object="serializedObjectOrJavaBean" codebase="classFileDirectory" width="pixelWidth" height="pixelHeight" > ... </embed>
Note:
The object
and embed
tags can be combined so that an applet can use the latest Java plug-in, regardless of the browser that downloads the applet.
Unlike the object
tag, all values specified in an embed
tag are attributes (part of the tag) rather than parameters (between the start tag and end tag), specified with a param
tag.
To supply argument values for applet parameters, you add additional attributes to the embed
tag.
The AppletViewer ignores the src
attribute that’s usually part of an embed
tag.
Either code or object is specified, not both.
The optional codebase
attribute supplies a relative URL that specifies the location of the applet class.
The type
attribute isn’t used by the AppletViewer, but should be present so that browsers load the plug-in properly.
For an applet, the value should be similar to:
<type="application/x-java-applet;version=1.1">...
or
<type="application/x-java-applet">...
For a serialized object or JavaBean, the type
parameter value should be similar to:
<type="application/x-java-bean;version=1.1">...
or
<type="application/x-java-bean">...
The pluginspage
attribute isn’t used by the AppletViewer, but should be present so that browsers load the plug-in properly. It should point to a Java plug-in in a network cab file with a value like:
pluginspage="http://java.sun.com/products/plugin/1.1/jinstall-11-win32.cab#Version=1,1,0,0"
applet
The applet
tag is the original HTML 3.2 tag for embedding an applet in an HTML page. Applets loaded using the applet tag are run by the browser, which may not be using the latest version of the Java platform. To ensure that the applet runs with the latest version, use the object
tag to load the Java plug-in into the browser. The plug-in then runs the applet.
<applet code="yourClass.class" object="serializedObjectOrJavaBean" codebase="classFileDirectory" width="pixelWidth" height="pixelHeight" > <param name="..." value="..."> ...alternate-text </applet>
Note:
Either code
or object
is specified, not both.
The optional codebase
attribute supplies a relative URL that specifies the location of the applet class.
The param
tags supply argument values for applet parameters.
app
The app
tag was a short-lived abbreviation for applet that’s no longer supported. The AppletViewer translates the tag and prints an equivalent tag that’s supported.
<app class="classFileName" (without a .class suffix) src="classFileDirectory" width="pixelWidth" height="pixelHeight" > <param name="..." value="..."> ... </app>