Java Code Analysis Options

To use Java Code Analysis for an AUT, you have to run the JVM of the AUT with a Java Agent. You can download the Java Agent package by selecting Java Code Analysis Agent under Help > Tools in the Silk Central menu. The Java Runtime Environment (JRE) version 1.7 or higher is required. You can use the following options for all supported Java versions:
Option
Description
port=19129
Optional: Port of code coverage service. When no port is specified the port 19129 is used.
coveragepath=[path1],[path2], ...
Pathes to the .jar files that are covered by the agent. If parts of a path contain whitespaces, you have to use quotes. For example: coveragepath="C:\Program Files\YourApplication\". If a folder is specified, the agent recursively looks for all .class files in this folder. If a folder with a trailing wildcard is specified, the agent looks for .jar files in this folder. Running the agent without specifying a coveragepath is not valid.
java -javaagent:agent.jar=coveragepath=
"C:Program Files\YourApplication\" Aut.jar
includes=[package1]:[package2]:[package3]: ...
Optional: Only packages that match these packages are considered for coverage. Wildcards (*) are allowed for specifying the included packages.
java -javaagent:agent.jar=includes=com.borland.* AUT.jar
excludes=[package1]:[package2]:[package3]: ...
Optional: Packages that are specified in the excludes option are ignored for code coverage. Wildcards (*) are allowed for specifying the excluded packages.
java -javaagent:agent.jar=includes=com.borland.*;
excludes=com.borland.internal* AUT.jar
Note: When both inclusions and exclusions are specified in the filters, the exclusions are evaluated first. If a class is both included and excluded through filters, this class will be excluded and no coverage data is generated for this class. If the filter option is not specified, coverage data is generated for all used classes, unless the coverage path option is set, in which case coverage data is generated for all classes in the coverage path.

Java Code Analysis Example

Example for Windows:
"<java_home_directory>\bin\java" -javaagent:agent.jar=port=19129;
coveragepath=C:\dev\deploy\lib\library1.jar,C:\dev\deploy\lib\library2.jar;
includes=com.borland.*;excludes=com.borland.internal.* com.borland.MyApplication
Example for Linux (including quotation marks):
"<java_home_directory>/bin/java" -javaagent:agent.jar="port=19129;
coveragepath=/tmp/dev/deploy/lib/library1.jar,/tmp/dev/deploy/lib/library2.jar;
includes=com.borland.*;excludes=com.borland.internal.*" com.borland.MyApplication