# Got error when installing X-Pack

**URL:** <https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211>\
**Category:** Elasticsearch\
**Created:** [November 17, 2017, 11:29pm UTC](https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211 "2017-11-17T23:29:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jxz](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jxz](https://discuss.elastic.co/u/jxz)\
**Post date:** [November 17, 2017, 11:29pm UTC](https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211/1 "2017-11-17T23:29:02Z")

</div>

Hi,

I got the error "Error: Could not find or load main class Xms4g -Xmx4g" when trying to install X-Pack with the command "bin\elasticsearch-plugin install C:\Users\xzhang\Downloads\x-pack-5.2.2.zip" under %ES\_HOME% on a Windows Server 2013 R2 Standard machine.

What could be the reason and how to fix the issue?

---

<div class="post-metadata">

**Author:** ![jxz](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jxz](https://discuss.elastic.co/u/jxz)\
**Post date:** [November 17, 2017, 11:32pm UTC](https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211/2 "2017-11-17T23:32:43Z")

</div>

Update: I got the same error with the command "bin\elasticsearch-plugin install x-pack" too.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [November 18, 2017, 12:00am UTC](https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211/3 "2017-11-18T00:00:59Z")

</div>

It looks like the Elasticsearch script is picking up broken JVM arguments from somewhere.

`Xms4g -Xmx4g` should be `-Xms4g -Xmx4g`

Have you recently edited your _jvm.options_ file, or changed the `ES_JAVA_OPTS` environment variable?  
One of those two configuration options probably has the wrong value.

---

<div class="post-metadata">

**Author:** ![jxz](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jxz](https://discuss.elastic.co/u/jxz)\
**Post date:** [November 18, 2017, 12:27am UTC](https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211/4 "2017-11-18T00:27:52Z")

</div>

Thanks Tim. The env variable had been wrong. I fixed the env variable. but now I got this error instead:

Invalid initial heap size: -Xms4g -Xmx4g  
Error: Could not create the Java Virtual Machine.  
Error: A fatal exception has occurred. Program will exit.

Any insight on what could be wrong again.

---

<div class="post-metadata">

**Author:** ![jxz](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jxz](https://discuss.elastic.co/u/jxz)\
**Post date:** [November 18, 2017, 12:52am UTC](https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211/5 "2017-11-18T00:52:01Z")

</div>

Never mind! After removing that env variable altogether, the installation proceeds successfully now.

---

<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:** [December 16, 2017, 12:52am UTC](https://discuss.elastic.co/t/got-error-when-installing-x-pack/108211/6 "2017-12-16T00:52:08Z")

</div>

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