wood burning stoves 2.0*
The moose likes Performance and the fly likes Java heap space exception(outofmemoryexception) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Java heap space exception(outofmemoryexception)" Watch "Java heap space exception(outofmemoryexception)" New topic

Java heap space exception(outofmemoryexception)

Tilak Gorantala

Joined: Jan 18, 2013
Posts: 21
Hi Team,

I am building a war using Maven through command prompt. I am getting an error as - "Java Heap Space exception" after compiling using maven. Please tell me how to increase heap memory size.

Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

If you're getting the exception during the maven compilation, then there's probably a maven command line arg or pom element you can set to specify heap size. You'd have to look at maven's docs or google for something like how to set heap size in maven.

If you're getting while running your app, after compiling, then maven doesn't have anything to do with it. You can adjust the max heap size by adding a -Xmx arg to the JVM command line. Something like:

Since you're talking about a .war file, I assume this is a web app running under tomcat or jboss or something. The container will most likely have a config file or startup script where you can specify the heap size.

However, it may also be that your app needs more memory than you have available--either due to a design flaw or due to an actual requirement.
Tilak Gorantala

Joined: Jan 18, 2013
Posts: 21
Thanks Jeff,

It worked, I just increased my heap size to 1GB. Now my war file is almost built. Thanks for your quick reply. :-) :-)

I agree. Here's the link: http://aspose.com/file-tools
subject: Java heap space exception(outofmemoryexception)
Similar Threads
While testing with maven "java heap space" error
startNodeManager.sh and startWeblogic.sh doesn't start to execute
How Do I Find a Memory Leak?
maven -- java.lang.OutOfMemoryError: Java heap space
Tomcat 5.5 in Production