Perhaps you are running on a JRE than a JDK Error Resolution
If you are here you are probably bugged by the following error – No compiler is provided in this environment. Perhaps you are running on a JRE than a JDK? on your Eclipse console. Here is a pictorial representation of the error you might be receiving:
I was working on Maven when I bumped into this error. You might be facing this issue in your regular builds as well. Your build has failed and it won’t go forward until this minor inconvenience is taken care of.
The main reason you are getting this error is because Eclipse is unable to find a valid compiler and as it has insinuated that you are trying to run your program on a JRE which is causing this error.
Here’s how to get rid of the “No compiler is provided in this environment. Perhaps you are running on a JRE than a JDK?” error:
Steps to Resolve Perhaps you are running on a JRE than a JDK Error
Follow these steps to get rid of the compiler issue.
Step 1: The first step would be to navigate to Window > Preferences.
It will open you a dialog that might look something like this:
Step 2: Click on Java and then on Installed JREs to flare open the window for the same on the right hand side.
Step 3: Click on the entry and then on Edit button.
Doing so will open an Edit JRE dialog box. It is here that we need to change the JRE definition by changing the JRE home info.
Step 4: Click on the Directory button… next to JRE home to open the Browse for Folder dialog:
Step 5: Provide the location for your JDK. It might be located in your Program Files folder. Just click on it and then on Ok.
The path in your JRE home will automatically change.
Step 6: Once done click on Finish button.
Step 7: Click on Apply and then on Ok in the next screen.
Now that you will run your program again, that error message will no longer bother you.
Happy coding! 🙂
Check out our other Eclipse related tips and tricks as well.