Configure the Java agent for Play
There are three ways to run Contrast with Play:
Command line
Adding options to the application's JVM is a little different for Play than for standard Java options syntax. For Play, options must be prepended with -J. Replace
<YourContrastJarPath>
with the path to your Contrast JAR file. Replace the server with your environment, and add this line to your Play startup command:-J-javaagent:<YourContrastJarPath>
Script
If you run Play from a script calling the Play activator, use this command. Replace
<YourContrastJarPath>
with the path to your Contrast JAR file. Replace<YourJvmOptions>
and<YourPlayOptions>
with your JVM and your Play options. For example:activator -J-javaagent:<YourContrastJarPath> <YourJvmOptions> <YourPlayOptions> run
JAVA_OPTS
Older versions of Play have a known defect where they don't properly pass through the -J options. To work around this, set
JAVA_OPTS
in the command line before calling activator. Replace<YourContrastJarPath>
with the path to your Contrast JAR file and use:JAVA_OPTS="-javaagent:<YourContrastJarPath> $JAVA_OPTS" ./activator run