1

I have a project that uses java compliance 1.6 and I use jre8 to eclipse.

Eclipse prevents me from using java 7 & 8 syntax (like try with resources), however it does not prevent me from using java 7 or 8 classes (like java.util.Objects) .

Is there any way I can force eclipse to show an error if I accidentally use a class from a newer java version than the project's compliance level?

Edit: I have also noted that changing the execution environment to 1.6 does not help either. The only way around it is to include jre6 separately. Is that missing from Eclipse or is it done on purpose?

I know how to use a different compliance level. My question is why changing the compliance of a specific project not enough without using an older jre.

Stelium
  • 1,207
  • 1
  • 12
  • 23

1 Answers1

1

Configure System library in project properties.

project properties

You may need an 1.6 JDK to achieve this. Configure it in Installed JREs preferences.

See also: Change JDK for a project Configure JRE

Community
  • 1
  • 1
Basilevs
  • 22,440
  • 15
  • 57
  • 102
  • so it cannot be done if I am using jdk 1.8 ? Also would it make a difference on using jre instead of jdk for this? Still eclipse checks for syntax, shouldn't it check for the classes' versions as well ? – Stelium Dec 15 '15 at 21:45