Ant Errors: “Error starting modern compiler”

In my case, this error appeared when I attempted to run an Ant script through Eclipse, that was designed to compile Java classes and package them into a ZIP file.

BUILD FAILED
%my XML file%: Error starting modern compiler

This problem can arise in different development environments, and for different reasons – though generally these reasons are all related – the version of Java being used by the compiler does not match that already loaded by the VM, or being referred to in JAVA_HOME.

To solve this in Eclipse, I first went to Run > External Tools > External Tools Configurations … and accessed the JRE tab.

The next step, change from “Run in the same JRE as the workspace” to specifying a “Separate JRE”:

However, this change still resulted in the “modern compiler” error being displayed. The final step? Despite the prompt asking for a separate JRE – it is in fact the JDK that needs to be selected:

And voila – you should now see these happy words…

BUILD SUCCESSFUL

This entry was posted in Code Monkey and tagged , , , , . Bookmark the permalink.

20 Responses to "Ant Errors: “Error starting modern compiler”"

Leave a Reply

Your email address will not be published. Required fields are marked *


*