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.
%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…