1

I want to build my code with Java 6, but use compile time checks of Java 5.

For example, I want the compiler to complain about @Override annotation for interfaces (introduced in Java 6).

Do you know how to do this?

DNA
  • 42,007
  • 12
  • 107
  • 146
kms333
  • 3,147
  • 7
  • 31
  • 39

3 Answers3

3

go with right mouse button on your project->properties->java compiler

ther you can enable "Enable project specific settings" and choose an own compiler java version

fnobbi
  • 90
  • 5
0

The JRE preference seems to be at the workspace not project level. To change the JRE, Window...Preferences. Open up the tree under 'Java'. Choose "Installed JREs". If there's only one there, you can't remove it. Click 'Add...'. Browse to the base directory of the Java installation, e.g. /usr/java/jdk1.6.0. Give the JRE a name and click OK. This adds the new JRE to the list of JREs available. To select it as the default JRE, it must be checked in the Installed JREs window.

Sajan Chandran
  • 11,287
  • 3
  • 29
  • 38
0

If you are using Maven (or Ant) for building your project, then you can specify Java 6 in Maven and keep eclipse using Java 5.

adranale
  • 2,835
  • 1
  • 21
  • 39