# Adding environment to java APM Agent for JBoss

**URL:** <https://discuss.elastic.co/t/adding-environment-to-java-apm-agent-for-jboss/265616>\
**Category:** APM\
**Tags:** java\
**Created:** [February 26, 2021, 1:17pm UTC](https://discuss.elastic.co/t/adding-environment-to-java-apm-agent-for-jboss/265616 "2021-02-26T13:17:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [February 26, 2021, 1:17pm UTC](https://discuss.elastic.co/t/adding-environment-to-java-apm-agent-for-jboss/265616/1 "2021-02-26T13:17:23Z")

</div>

In the [documentation](https://www.elastic.co/guide/en/apm/agent/java/current/setup-javaagent.html#setup-jboss-wildfly) the manual setup for JBoss says that you have to add this lines to the standalone.conf file

```auto
export JAVA_OPTS="$JAVA_OPTS -javaagent:/path/to/elastic-apm-agent-<version>.jar"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.service_name=my-cool-service"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.application_packages=org.example,org.another.example"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.server_url=http://localhost:8200"

```

and I wanto to add the environment, an the [documentation](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-environment) says that I have to add this property

```auto
elastic.apm.environment

```

so, following the pattern to add the enviroment I have to add this line?

```auto
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.environment=my-environment"

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 27, 2021, 1:27am UTC](https://discuss.elastic.co/t/adding-environment-to-java-apm-agent-for-jboss/265616/2 "2021-02-27T01:27:33Z")

</div>

Yes that should work.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 19, 2021, 9:28pm UTC](https://discuss.elastic.co/t/adding-environment-to-java-apm-agent-for-jboss/265616/3 "2021-03-19T21:28:34Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
