When I run my Ant build in Eclipse, I'm getting the following error message and the Ant build fails.
Error Message: Error running javac.exe compiler
Line where the build stops:
<javac destdir="${classes.home}" debug="on" fork="true" memoryinitialsize="512M" memorymaximumsize="1G">
<classpath refid="classpath"/>
<src path="${source.home}"/>
</javac>
Has anyone faced a similar problem before? or does anybody know what's wrong here?
System Information: Eclipse Helio, JDK 1.5
Try to free some main memory. Close memory-hungry programs, and stop memory-hungry processes if you can.
I solved this by checking my Environment Variables in my Windows 7. I found that JAVA_HOME is pointing to C:\ Program Files (x86)\Java\jdk1.6.0_31 when it supposed be C:\ Program Files\Java\jdk1.6.0_31. If you want to know how read this
I removed fork="true" and I got past that piece of code. What might be interesting to those of you who have this problem is that now, at that line, I get the output:
So it may be an issue with memoryMaximumSize if you need to keep your fork="true" setting, as suggested above.
For me it was backup libs inside WEB-INF/lib directory. I had multiple lib directory inside the main lib. And the classpath was including them all causing the javac command to become too long.
I removed those directories and it worked for me.