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
If you are running ant in eclipse click run as --> Ant second option and choose JDK path and run the build again.
I've tried everything but nothing worked for me till I've set (fork='no' or fork='false' in your case) and worked for me perfectly
I fixed the problem like this:
My Java home folder had the wrong path. It should have been
C:\Program Files (x86)\Java\jdk1.5.0_15
but instead it wasC:\Program Files (x86)\Java\jdk1.5.0_15\bin
.The accepted answer didn't work for me. But right-clicking in Ant and setting the Java Runtime Environment (JRE) to the Jave Development Kit (JDK) worked for me.
Abhi Rampal's answer is the step by step the same way I solved the problem on my eclipse.
Configuring eclipse to point to JDK instead of JRE did not work for me. With further investigation, I solved this problem by stopping the build process from forking. In your build.xml, remove the attribute
fork
from<javac>
tag.Try changing memorymaximumsize="1G" to memorymaximumsize="512M".