# `JAVA_TOOL_OPTIONS` supports in Heroku
[TOC]
###### tags: `heroku` `java`
---
## About JAVA_TOOL_OPTIONS
You can override these settings in the `Procfile` command (which takes precedence over the defaults). For example, to change the default of `-Xmx300m`, you could pass in:
```
web: java -Xms150M -jar target/myapp.jar
```
When a Java process is started on your dyno, the following Java options will be added to JAVA_TOOL_OPTIONS and automatically picked up by Java:
- `-Dfile.encoding=UTF-8`
- `-XX:+UseContainerSupport` (for Java 11 and higher)
## Adjusting Environment for a Dyno Size
When a new dyno type is selected, the following settings are ~~automatically~~ added to `JAVA_TOOL_OPTIONS`:
- `free`, `hobby` or `standard-1x`: **`-Xmx300m -Xss512k -XX:CICompilerCount=2`**
- `standard-2x`: **`-Xmx671m -XX:CICompilerCount=2`**
- `performance-m`: **`-Xmx2g`**
- `performance-l`: **`-Xmx12g`**
For Private Space dynos, the values are:
- `private-s`: **`-Xmx671m -XX:CICompilerCount=2`**
- `private-m`: **`-Xmx2g`**
- `private-l`: **`-Xmx12g`**
## Monitoring Resource Usage
Additional JVM flags can be used to monitor resource usage in a dyno. The following flags are **recommended for monitoring resource usage**:
```
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+UseConcMarkSweepGC
```
See the [troubleshooting article](https://devcenter.heroku.com/articles/java-memory-issues "Troubleshooting Memory Issues in Java Applications") for more information about tuning a JVM process.
## Reference
- [Heroku Java Support](https://devcenter.heroku.com/articles/java-support)