Configure the Java agent for standalone applications

The process to run the Java agent on a standalone application is very similar to the standard process for installing and configuring a Java web application.

To configure the Java agent for a standalone application, pass the name of your application in the contrast.agent.java.standalone_app_name system property.

For example, replace <YourContrastJarPath> and <YourAppJarPath> with the file paths to your Contrast JAR and your application JAR. Replace <YourAppName> with your application name, and use these commands:

java -javaagent:<YourContrastJarPath> \
-Dcontrast.agent.java.standalone_app_name=<YourAppName> \
-jar <YourAppJarPath> \
<application arguments>

Tip

There are multiple ways to configure an agent, aside from using system properties.

If your application’s JAR includes shaded dependencies the Java agent can’t directly determine library usage. Instead, the Java agent will report a list of JARs based on the information gathered from the pom.properties files provided with the included libraries.

Important

In some cases, like multi-tenant configuration, you may wish to configure the agent to use a single application name but do not wish to treat application server code as belonging to the application. In this case, use application.name instead. Certain features like route coverage and build-based views do not work with application.name as they do with agent.java.standalone_app_name.