How to resolve - you are running on a JRE rather than a JDK?


While setting up a maven project in eclipse and executing the code, we often come across an eclipse error that says -

COMPILATION ERROR -
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

you are running on a jre rather than a jdk

Here we need to make sure that the JDK is set in the build path of the java project, along with other settings like compliance level, build path configuration, compatibility of eclipse version with JDK, environment variables, etc. This article provides step by step process to resolve the eclipse error -you are running on a JRE rather than a JDK.



1. Open the eclipse, Go to the Window, and then select Preferences

window preferences

2. Select installed JREs from the left-hand options

installed JREs

3. Now click Add button on the installed JREs window.
Add JRE popup will open. Here, click on the 'Directory' button against the JRE home field to browse through the JDK folder and select the JDK root directory and click ok.

adding jdk to jre home

Once you click ok, the JRE home, JRE name, and system libraries get populated.

jre home gets populated

4. Click on the Finish button and check if the installed JRE window gets populated with the required JDK. Check the checkbox against the JDK path and click apply.



5. Now execute the maven project through pom.xml by right-clicking the pom.xml and selecting Run as --> Maven test

If the project is still failing with compilation errors, then check the compliance level is set properly, all the required external JARs (libraries) are set through the configure build path. And lastly, the environment variables for JAVA_HOME and MAVEN_HOME are set through the system's advanced settings.


Quantitative aptitude - practice tests


A series of aptitude practice tests comprising multiple-choice questions (MCQ) on varied aptitude topics that evaluate the quantitative ability.