Add the Snyk agent to your project in order to start using Snyk Runtime Monitoring for your Java applications.
Download the runtime agent and unzip the archive.
From the extracted files, copy:snyk-java-runtime-agent.jaralongside your application files.
Create a snyk-agent.properties file at the same location as the agent jar file.
The properties file should contain the Snyk project ID.
Add the agent as a command-line argument to the Java command that you use to start your application.
-javaagent:path/to/snyk-java-runtime-agent.jar -jar my-app.jar
Add the jar file as follows:
If you are using Apache Maven, add the following file to your Maven options environment variable:
If you are using JavaEE containers such as GlassFish, add the following file to the JVM Options:
Once you have successfully added the agent, logging begins to appear in the stderr (standard error) file shortly after the JVM (Java virtual machine) starts up, as in the following example:
//Example of successful Java agent installation snyk-agent initialisation: startup snyk-agent initialisation: trying: /opt/app-1/agent/snyk-agent.properties snyk-agent initialisation: switching logging to: /opt/app-1/agent/snyk-logs/agent-log-2001-02-03T04:05:06.log