Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Invalid maximum heap size" when running Maven

I'm having problems setting up maven. I'm using windows 7 64 bit with 4 GB of RAM.

I get this error when trying to run mvn:

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

Here are my user variables:

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_55

M2=%M2_HOME%\bin

M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.2.1

MAVEN_OPTS=-Xms256m -Xmx512m

Path=%M2%;%JAVA_HOME%\bin
like image 669
metaphizix Avatar asked May 21 '14 15:05

metaphizix


Video Answer


1 Answers

User @med_alpa had the right suggestion in my case (Windows):

I resolved the same issue on windows executing this command on windows command line : set MAVEN_OPTS=-Xmx1024M -XX:MaxPermSize=256M

So make sure to not put quotes around the value you set for MAVEN_OPTS

like image 173
Adriaan Koster Avatar answered Oct 12 '22 18:10

Adriaan Koster