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,
Not only heap memory. You have to increase perm size also to resolve that exception in maven use these variables in environment variable.
variable name: MAVEN_OPTS
variable value: -Xmx512m -XX:MaxPermSize=256m
Set the environment variable:
Alternatively use
set MAVEN_OPTS="-XX:MaxPermSize=256m"
while running from command prompt.Try to change or update your Maven install. I had this problem but I solved it by upgrading Maven (3.0.5 to 3.3.3).
It depends on which JVM instance require more memory. As example, if tests are forked (by default), and fails due OutOfMemoryError then try configure plugin which launching them:
on a Unix-like system:
OutOfMemoryError