Shahid
Shahid

Reputation: 481

Ant Build Failed - java.lang.OutOfMemoryError: Java heap space

To the guys keen to tag it as a duplicate question, please wait and read below:

Before posting this question, I have searched the SO extensively but none of the solution given for the OutOfMemoryError worked for me. I was getting this issue when using the ant build. The solution that didn't work:

1. export ANT_OPTS=-Xmx1g
   ant

2. set ANT_OPTS=-Xmx1g
   ant

3. export ANT_OPTS="-Xmx2g -XX:MaxPermSize=512m"

and few others as well

Upvotes: 0

Views: 2506

Answers (1)

Shahid
Shahid

Reputation: 481

So here is the solution that I found for my problem:

Since the project that was failing and throwing OutOfMemory error has it own build.xml file. In the build.xml file, there was a property tag that allocates the memory needed for java compiler. That memory was low. After increasing the memory allocation, it resolved my problem.

<property name="javac.max.memory" value="2024M" />

Hope it helps

Upvotes: 1

Related Questions