If you have downloaded Eclipse or STS IDE for Spring projects, it's possible that while compiling/building/running your Java project you may get the following error with BUILD FAILURE message in the console.
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
This error doesn't mean that your project has some problem but it is just because some wrong Java related configuration in your IDE which you must correct to successfully run your project. Here is the way to solve No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK Error.
To fix this issue you will have to update your IDE preferences. This solution assumes that you are using Eclipse IDE for development.
Steps to Resolve the Issue
Go to Window > Preferences > Java > Installed JREs > and check your installed JREs. You should have an entry with a JDK there. But because you are seeing this error, you will find an entry for JRE instead, similar to the snapshot below.
Now select the entry, click on Edit and then change the path from JRE to JDK.
Once you have changed the Installed JRE entry to JDK, click on Apply and Close.
If you have a Maven project, Right-Click on your Project > Maven > Update Project
Hope this helps you fix your issue, if not, feel free to post a comment below and we will definitely to help you.
You may also like: