Monitoring Java Code from the Command Line

Related Topics

To monitor Java applets, class files, JAR files. or code launched by container programs, from the command line, type:

For an applet:

coverage [<PureCoverage options>] /java [/jit] <applet viewer> {<applet viewer options>} <applet>

For a class file:

coverage [<PureCoverage options>] /java [/jit] <Java viewer> [<Java viewer options>] <class>

For a JAR file:

coverage [<PureCoverage options>] /java <Java viewer> [<Java viewer options>]<JAR switch> <JAR file>.jar <class>

For a container program:

coverage [<PureCoverage options>] /java [/jit] <exename> [<arguments to <exename>]

Where

Represents

[<PureCoverage options>]

Options you can specify after the coverage command. For a list of options, click images\shortcut.gif

/java

Required for Java programs.

<applet viewer>

Your applet viewer. For example:

n      appletviewer.exe (with the full path) if you are using the Sun JVM

[<applet viewer options>]

Options that you normally use with your applet viewer.

<applet>

An HTML file (local applet) or a URL (Web applet).

<Java viewer>

Your Java viewer. For example:

n      java.exe if you are using the Sun JVM

[<Java viewer
options>]

Options that you normally use with your Java viewer.

<class>

A class name.

<JAR switch>

The switch that your Java viewer requires for running a JAR file. For example:

§    -jar for the Sun viewer.

<JAR file>.jar

The name of your JAR file including the extension.

<<exename>>

Any container program.

[<arguments to <exename>>]

Arguments to pass to the container program.

For example, to monitor a local applet using the Sun JVM and save the coverage data, you can type:

coverage /SaveData=index.cfy /java appletviewer file:///"C:\Program Files\MyJavaProjects\index.html""

PureCoverage launches the applet Index.htm, and saves the collected coverage data to the PureCoverage data file (.cfy) Index.cfy without displaying any data coverage windows.

To monitor a Web applet, you can type:

coverage /java <path to IE>\iexplore.exe -new http://www.myDomain.com/javaDev/myProjects/myApp/index.html

PureCoverage runs Internet Explorer, with the specified argument -new, then launches the applet index.htm and displays the Run Summary window as it collects coverage data for the applet.

Notes:

§                  For information about configuring your Java Runtime Environment for PurifyPlus, click images\shortcut.gif.

§                  PureCoverage requires debug data to monitor methods at the line leve l or the function level. For instructions for compiling Java code with debug data, refer to the documentation for your JVM.

§                  To run programs from the command line, you must have the RationalPurifyPlus/common directory in your PATH environment variable.

§                  When monitoring Java applets launched by Internet Explorer 4.0 with the Active Desktop installed, you must pass the -new argument to Internet Explorer. Otherwise, coverage data is not collected for your applet. To check whether the Active Desktop is installed, right-click your desktop and select Properties from the shortcut menu. If the Active Desktop component is installed, the Properties dialog box has a Web tab.

(C) Copyright IBM Corporation 1993, 2010.