Maven throws "java.lang.OutOfMemoryError"

user124858 picture user124858 · Dec 17, 2009 · Viewed 53.8k times · Source

I'm compiling an open source project with "mvn install" but ended up with java.lang.OutOfMemoryError: Java heap space. I tried to execute java -Xmx256m but the output was java synopsis which indicated it's an invalid command.

I'm using jdk1.5.0_08, any ideas why this is happening?

Thanks,

Answer

cletus picture cletus · Dec 17, 2009

Set the environment variable:

MAVEN_OPTS="-Xmx512m"