How to Change Eclipse Java Version for Compiler and JRE
February 22, 2016
This page will provide how to change eclipse java version for compiler and JRE. We can install all the JREs versions in eclipse which are present in our operating system but we can activate only one at a time in eclipse IDE. The compiler compliance level in eclipse is available only up to that level of java version for which our eclipse version supports. In our demo we are using Eclipse Luna 4.4.2 version which supports compiler compliance level up to Java 8 i.e 1.8. Here on this page we will provide step wise demo to install JRE in eclipse as well as to change compiler compliance level and settings. The activated JRE version and selected compiler compliance level must be same.
Install JRE in Eclipse
Find the steps to install JRE in eclipse.Step 1: Go to Window -> Preferences
Step 2: Go to Java -> Installed JREs
Step 3: Click on Add and select Standard VM and then click on Directory and select JRE home or JDK home. We can add more than one JRE versions. Find the print screen

Step 4: Select the check box to activate the required version of JRE. In our demo we have activated JRE 1.8.
Configure Compiler Compliance Level and Settings
To configure compiler compliance level and settings in eclipse, find the below steps.Step 1: Go to Window -> Preferences
Step 2: Go to Java -> Compiler . Find the print screen.

Step 3: Select Compiler compliance level
Step 4: To change default compliance settings, we need to uncheck Use default compliance settings and set the compiler java version for .class and source compatibility.
Step 5: We can also change the settings here for class file generation such as to add variable attribute, line number, source file name to generated class file which is used by the debugger. We can also change the settings to preserve unused local variables and to store information about method parameters introduced in java 8
If the version of compiler compliance level and Installed JRE is different, eclipse gives the messages as follows.
"When selecting 1.8 compliance, make sure to have a compatible JRE installed and activated (currently 1.7)"
These settings will be effective for new projects.
Project specific Compiler Compliance level and Settings
To change project specific compiler compliance level and settings, we need to follow below steps.Step 1: Right click on selected java project and then click on Properties.
Step 2: Click on Java Compiler and then perform the changes.
Whenever we change the settings, eclipse rebuilds the project. It gives the message as follows.
"The compiler settings have changed. A rebuild of the project is required for changes to take effect. Build the project now?"
We need to click on Yes button.