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?

3
  • I am not sure if this is possible. Commented Feb 17, 2012 at 12:46
  • Are you using Ant to build. If so I think then you can ask ant to compile and build using Java 6. Whereas to enable Java 5 checks right click on the project and set Java Compiler compliance to Java 5 Commented Feb 17, 2012 at 12:48
  • You need to use different compilers for same project? Commented Feb 17, 2012 at 12:50

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

2 Comments

Seems kms333 needs to use different compilers to a same project. Check once.
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.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.