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,
OutOfMemoryError: Java heap space. 1) An easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options "-Xmx512M", this will immediately solve your OutOfMemoryError.
It is possible to start Maven and sbt with increased memory. We recommend you increase the Maximum Metaspace size and the Thread Stack size. These values can be set using -Xss2M -XX:MaxMetaspaceSize=1024M . The exact values may depend on your hardware and your code base.
lang. OutOfMemoryError exception. Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. In this case, The garbage collector cannot make space available to accommodate a new object, and the heap cannot be expanded further.
Set the environment variable:
MAVEN_OPTS="-Xmx512m"
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:
<plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine>-Xmx1024m</argLine> </configuration> </plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With