Accepted answer

click on the add library button. it brings your screen to point to the java location.

select "directory", button right besides jre home and point to the installed folder location.

even though you want to just 1.5 compiler project, you can achieve it by changing compiler settings in eclipse instead of removing 1.6 jre and add 1.5 jre.

goto -->java--compiler---> and change compiler level to `1.5` instead of `1.6`

as davidfmatheson suggested,

just be careful, especially if you're setting this up for a team of people to work on. if anyone uses anything that is new or changed in 1.6, it will compile, but not run in an environment with jre 1.5.


as i was facing this issue minutes ago, in case you are trying to open an existing project in an environment with a newer jdk, make sure you pdate the jdk version in project properties -> project facets -> java.


see the page set up jdk in eclipse. from the add button you can add a different version of the jdk...


the jdk (java_home) used to launch eclipse is not necessarily the one used to compiled your project.

to see what jre you can select for your project, check the preferences:

generaljava installed jre

by default, if you have not added any jre, the only one declared will be the one used to launched eclipse (which can be defined in your eclipse.ini).

you can add any other jre you want, including one compatible with your project.

after that, you will need to check in your project properties (or in the general preferences) what jre is used, with what compliance level:

alt text


eclipse - specific project change jdk version -

if you want to change any jdk version of a specific project than you have to click ---> project --> jre system library --> properties ---> inside classpath container (jre system library) change the execution environment to which ever version you want e.g. 1.7 or 1.8.


in the preferences section under java -> installed jres click the add button and navigate to the 1.5 jdk home folder. then check that one in the list and it will become the default for all projects:

enter image description here


if you are using maven build tool then add the below properties to it and doing a maven update will solve the problem



right click project -> properties -> java build path -> select jre system library click edit and select jdk or jre after then click java compiler and select compiler compliance level to 1.8

enter image description here

enter image description here

enter image description here


click on the window tab in eclipse, go to preferences and when that window comes up, go to javainstalled jresexecution environment and choose javase-1.5. you then have to go to compiler and set the compiler compliance level.

changing jre

enter image description here

Related Query

More Query from same tag