---
title: "Java APM on Linux"
slug: "java-apm-with-linux"
description: "Easily install the Java APM Profiler for Linux with this step-by-step guide. Enable Stackify Java Profiler & configure your Java application for APM insights."
updated: 2020-05-01T15:37:06Z
published: 2020-05-01T15:37:06Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Java APM on Linux

This document details how to install the **Java APM Profiler** in your **Java** application running on **Linux**.

## Prerequisite

Follow the [Retrace Linux Install](/docs/linux-installation) Guide.

## Step 1 - Enable the Stackify Java Profiler

The **Stackify Java Profiler** is enabled by the `-javaagent` JVM option:

#### Tomcat

Modify **catalina.sh** or **setenv.sh**: `CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"`

#### Wildfly / JBoss

Modify **standalone.conf**: `JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"`

#### Jetty

Modify **jetty.sh**: `JAVA_OPTIONS="$JAVA_OPTIONS -javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"`

#### Glassfish

Add the following line to the **java-config** section of the Glassfish **domain.xml** file: `&lt;jvm-options&gt;-javaagent:"/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar"&lt;/jvm-options&gt;`

#### WebSphere

Create a **jvm.options** under **WEBSPHERE/usr/servers/SERVER** with: `-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar`

Depending on your preferences, you may configure a single JVM or all Liberty JVMs with your options file.

- To apply these settings to a **single** server, save **jvm.options** at `${server.config.dir}/jvm.options`
- To apply these changes to **all Liberty JVMs**, save **jvm.options** at: `${wlp.install.dir}/etc/jvm.options`. This will take effect for all JVMs that do not have a locally defined **jvm.options** file.

#### Play Framework 1.2.x - 1.4.x

Before running your application, enter the following command: `export JAVA_OPTS='-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar'`

#### Play Framework 2.x+

Run the application with the following argument: `-J-javaagent:/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar`

## Step 2 - Configure Application

Configure how your Java application is identified by using a properties file or passing in java system properties.

#### Properties File Option

Create a **stackify-api.properties** file inside your application's classpath with the following contents:

```
stackify.application=My Java Application 
stackify.environment=Production
```

#### Java System Properties Option

**Application** and **Enviornment** can be setup by passing in **Java System Properties** via:

```
java -DSTACKIFY_APPLICATION_NAME="My Java Application" -DSTACKIFY_ENVIRONMENT_NAME="Production"  ...
```

---

Restart Your Web Server
 After modifying your configuration, you must now restart your application server.
