If you’re using terminal in conjunction with Maven, the easiest way to increase the heap size on your JVM using OS X is as follows:
1) Using Sudo mode, open up you bash profile (mine lives at ‘/etc/profile’)
2) Add “MAVEN_OPTS=’-Xms256M -Xmx512M’; export MAVEN_OPTS;”
3) Save your profile.
4) Open a new shell and ensure the MAVEN_OPTS var exists by using the “set” command and searching for MAVEN_OPTS.
5) Enjoy your java.
Peace!
3 Comments
Hello, I have added the following to profile…
MAVEN_OPTS=”-Xms256M -Xmx512m”; export MAVEN_OPTS;
and when I open a new shell I just get…
-bash: -Xmx512m?: command not found
and I cannot find it in the set, do you know what may be happening?
cheers,
Nikolaus
I’ve updated the original post – note that double quotes around “-Xms256M -Xmx512M” has been changed to single quotes as per this explanation of the meaning of quote type in BASH:
http://www.wiredrevolution.com/bash-programming/single-versus-double-quotes-in-bash
Thanks you Chad for your help,
It seems that it is best to copy and paste the code into an editor like pico so that the encoding does not affect it. I used text edit on the first go, without success, so good luck and it seems to have worked great, thanks for the quick fix!