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 compile
If the accepted answer above doesn't solve the problem for you (as it didn't for me), after updating the java.home to JDK instead of JRE as suggested in the accepted answer above, Go to Run -> External Tools -> External Tools Configuration -> select your build.xml on the left menu -> select JRE tab -> select the JDK(from the dropdown) for Separate JRE radio button option -> Click Run.
This should fix the problem.
I faced the same problem, and here is my advice, maybe it will help someone.
In fact, message Error running javac.exe compiler
means that something went wrong. The question is, what exactly. When Ant runs javac
task with fork="true"
flag, it doesn't print any error details. In my case, it didn't print them even after I added verbose="true"
, as suggested here. Solution was to add -verbose flag to Ant command line:
ant -verbose
After this, Ant starts printing full error messages, so you are able to fix a problem.
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
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.
That's a very simple issue. The base directory path has to many subfolders that leads to the actual folder. For e.g.: /folder1/folder2/.../.../folderN/{project}
Decrease the base directory path size and it will compile easily. For e.g.: D:/{project}
Thank me later.