Got error when installing X-Pack

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?

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

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.

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.

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