20080414 Monday April 14, 2008

Fixing OutOfMemory errors with Ant

Ever get this while running an Ant task like wsdl2java or javac?

java.lang.OutOfMemoryError: Java heap space

The solution is pretty simple. Increase the amount of memory for the Ant JVM. On Linux, you could issue the following in a Shell command:

export ANT_OPTS="-Xms512m -Xmx512m"

Windows would be similar in a command prompt before calling Ant:

set ANT_OPTS="-Xms512m -Xmx512m"

Of course, make sure you have that much memory available first. If not, try a smaller value like 256m.

Posted by rickg ( Apr 14 2008, 12:45:13 PM PDT ) Permalink Comments [0]