Run JBoss with the Java agent

You can either run JBoss from a BAT file, or in domain mode.

  • BAT file: If you run JBoss from domain.bat, standalone.bat, or run.bat with a .conf file, modify the configuration file. It should enable the Contrast JVM parameters and return to the start-up script.

    To do this, replace <YourContrastJarPath> with the path to your Contrast JAR file, and use the JBoss server directory for your environment. Then add this line to the end of your .conf file:

    • Windows:

      set JAVA_OPTS=-javaagent:<YourContrastJarPath> %JAVA_OPTS%
    • Unix/Linux:

      JAVA_OPTS=-javaagent:<YourContrastJarPath> $JAVA_OPTS
  • Domain mode: If you run JBoss 6 EAP or JBoss AS 7.X in Domain mode using domain.bat or domain.sh, you must add the -javaagent switch to the JVM options in $JBOSS_HOME/domain/configuration/domain.xml.

    In this example, replace <YourContrastJarPath> with the path to your Contrast JAR file:

    <server-group ...>
      <jvm name="default">
        <jvm-options>
          <option value="-javaagent:<YourContrastJarPath>"/>
        </jvm-options>
      </jvm>
    ...
    </server-group>