# Use jvm.options or ES\_JAVA\_OPTS to configure the JVM ES\_HEAP\_SIZE=16G: set -Xms16G and -Xmx16G in jvm.options or add "-Xms16G -Xmx16G" to ES\_JAVA\_OPTS

**URL:** <https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962>\
**Category:** Elasticsearch\
**Created:** [June 11, 2017, 8:48pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962 "2017-06-11T20:48:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![francis1](https://avatars.discourse-cdn.com/v4/letter/f/c5a1d2/32.png) [@francis1](https://discuss.elastic.co/u/francis1)\
**Post date:** [June 11, 2017, 8:48pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/1 "2017-06-11T20:48:14Z")

</div>

At the moment I’ve been trying to run elasticsearch 5.2.2 as elastic user but I have been getting the following error.

Use jvm.options or ES\_JAVA\_OPTS to configure the JVM  
ES\_HEAP\_SIZE=16G: set -Xms16G and -Xmx16G in jvm.options or add "-Xms16G -Xmx16G" to ES\_JAVA\_OPTS

I have tried changing the jvm.options by altering Xms and Xmx min and max heap size and adding this line to jvm.options

ES\_JAVA\_OPTS="-Xm16g -Xmx16g" ./bin/elasticsearch

But still getting the same error. I was hoping someone could assist.

Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 11, 2017, 9:01pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/2 "2017-06-11T21:01:23Z")

</div>

You wrote Xm instead of Xms here. Typo?

---

<div class="post-metadata">

**Author:** ![francis1](https://avatars.discourse-cdn.com/v4/letter/f/c5a1d2/32.png) [@francis1](https://discuss.elastic.co/u/francis1)\
**Post date:** [June 11, 2017, 9:38pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/3 "2017-06-11T21:38:45Z")

</div>

Hi David yes that was a typo. Even with ES\_JAVA\_OPTS="-Xms16g -Xmx16g" ./bin/elasticsearch I am still experiencing the same error.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 11, 2017, 9:52pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/4 "2017-06-11T21:52:23Z")

</div>

Can you try:

```
ES_JAVA_OPTS="-Xms16G -Xmx16G" ./bin/elasticsearch
```

---

<div class="post-metadata">

**Author:** ![francis1](https://avatars.discourse-cdn.com/v4/letter/f/c5a1d2/32.png) [@francis1](https://discuss.elastic.co/u/francis1)\
**Post date:** [June 11, 2017, 10:06pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/5 "2017-06-11T22:06:43Z")

</div>

Just tried again now.

with ES\_JAVA\_OPTS="-Xms16G -Xmx16G" ./bin/elasticsearch

Still the same issue

Error: encountered environment variables that are no longer supported  
Use jvm.options or ES\_JAVA\_OPTS to configure the JVM  
ES\_HEAP\_SIZE=16G: set -Xms16G and -Xmx16G in jvm.options or add "-Xms16G -Xmx16G" to ES\_JAVA\_OPTS

I also included the error but I'm unsure what that means?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 11, 2017, 10:36pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/6 "2017-06-11T22:36:17Z")

</div>

Sounds like the env variable is still set. Can you remove it?

---

<div class="post-metadata">

**Author:** ![francis1](https://avatars.discourse-cdn.com/v4/letter/f/c5a1d2/32.png) [@francis1](https://discuss.elastic.co/u/francis1)\
**Post date:** [June 11, 2017, 11:33pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/7 "2017-06-11T23:33:53Z")

</div>

Okay how do I do that. Would I need to comment out

```
node.name: ${HOSTNAME}
network.host: ${ES_NETWORK_HOST}

```

under

`elasticsearch.yml`

or do I need to perform another action?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 12, 2017, 7:33am UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/8 "2017-06-12T07:33:17Z")

</div>

No I meant removing `ES_HEAP_SIZE`

---

<div class="post-metadata">

**Author:** ![francis1](https://avatars.discourse-cdn.com/v4/letter/f/c5a1d2/32.png) [@francis1](https://discuss.elastic.co/u/francis1)\
**Post date:** [June 22, 2017, 10:52pm UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/9 "2017-06-22T22:52:51Z")

</div>

Yes I've removed `ES_HEAP_SIZE` but I still keep getting the same error.

I had a look under /etc/sysconfig/elasticsearch and /etc/init.d/elasticsearch to try and understand what the env variables were.

This is what I found

```
# Sets the default values for elasticsearch variables used in this script
ES_USER="elasticsearch"
ES_GROUP="elasticsearch"
ES_HOME="/usr/share/elasticsearch"
MAX_OPEN_FILES=65536
MAX_MAP_COUNT=262144
LOG_DIR="/var/log/elasticsearch"
DATA_DIR="/var/lib/elasticsearch"
CONF_DIR="/etc/elasticsearch"

```

Although further down I found this

```
# export unsupported variables so bin/elasticsearch can reject them and inform the user these are unsupported
if test -n "$ES_MIN_MEM"; then export ES_MIN_MEM; fi
if test -n "$ES_MAX_MEM"; then export ES_MAX_MEM; fi
if test -n "$ES_HEAP_SIZE"; then export ES_HEAP_SIZE; fi
if test -n "$ES_HEAP_NEWSIZE"; then export ES_HEAP_NEWSIZE; fi
if test -n "$ES_DIRECT_SIZE"; then export ES_DIRECT_SIZE; fi
if test -n "$ES_USE_IPV4"; then export ES_USE_IPV4; fi
if test -n "$ES_GC_OPTS"; then export ES_GC_OPTS; fi
if test -n "$ES_GC_LOG_FILE"; then export ES_GC_LOG_FILE; fi
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 23, 2017, 7:45am UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/10 "2017-06-23T07:45:17Z")

</div>

If you really have the same exact error message, then I believe that something, somewhere is then setting `ES_HEAP_SIZE`. I'm sorry I can't help more but you probably need to find where it has been set. It can be in a `~/.profile`, in a startup script...

BTW how did you install elasticsearch?

May be just download a new version (take the ZIP distribution), unzip it then just launch `bin/elasticsearch` and see what happens. Might give you a clue.

---

<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:** [July 21, 2017, 7:45am UTC](https://discuss.elastic.co/t/use-jvm-options-or-es-java-opts-to-configure-the-jvm-es-heap-size-16g-set-xms16g-and-xmx16g-in-jvm-options-or-add-xms16g-xmx16g-to-es-java-opts/88962/11 "2017-07-21T07:45:19Z")

</div>

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