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,
Sometimes, if you use other programs inside maven, like in integration tests or Surefire, the MAVEN_OPTS is not enough. Apart from MAVEN_OPTS, try to use JAVA_TOOL_OPTIONS. This did the trick for me in Maven when running some integration tests:
Reference: osx maven running tests Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"
I always use this with my shell on ubuntu:
I experienced the same problem. According to this link it might help to change jvm implementation - this can be done by setting JAVA_HOME system variable.
Try for example in the link mentioned ibm jvm or oracle jrockit: