/a — Applet Viewer Option (JVIEW/WJVIEW)

Use the /a option to invoke an applet viewer — a browserless environment for viewing applets. Applets that are run within the applet viewer behave in the same manner as those hosted within a browser, including loading, sound, and security. The applet viewer accepts applet parameters and class names, in addition to URLs and HTML filenames.

The /a option directs JVIEW or WJVIEW to run an applet and requires your Java project to have an public void init() method. If your Java project has a public static void main(String args[]) method, use JVIEW or WJVIEW without the /a option to run it as an application.

Note   When the /a option is used, any remaining command-line tokens become parameters for the applet viewer.

Example

The following command-line statements run the HelloWorld applet in an applet viewer for JVIEW or WJVIEW, respectively:

JVIEW /a HelloWorld

-or-

WJVIEW /a HelloWorld

You can load an applet either by using an HTML file to specify parameters, or by loading parameters directly from the command line. The following example shows how to load the HelloWorld applet from an HTML source file with the applet tag:

<applet code=MyApplet.class width=100 height=200>
               <param name=SomeName value=SomeValue></applet>

The same HelloWorld applet can run in JVIEW or WJVIEW with the following command-line information:

JVIEW /a width=100 height=200 SomeName=SomeValue HelloWorld

-or-

WJVIEW /a width=100 height=200 SomeName=SomeValue HelloWorld

The following examples show how to run more than one applet at a time from the command line:

JVIEW /a width=200 height=400 HelloWorld height=300 SpinningWorld

-or-

WJVIEW /a width=200 height=400 HelloWorld height=300 SpinningWorld

The results of the previous commands display the HelloWorld applet in a 200 x 400 frame and the SpinningWorld applet in a 200 x 300 frame.

Note   If no height and width are specified, the applets’s default size is one-third the size of the screen.

Any parameter, including HTML files, will be loaded from directory and .zip file locations specified by CLASSPATH information and the Java Package Manager (JPM) database. For example:

JVIEW /a /cp \src\bvt\HelloWorld.html

-or-

WJVIEW /a /cp \src\bvt\HelloWorld.html