How do I specify an old JDK compliance in an Eclipse project?

192 views Asked by At

I have a project that I need to be compatible with only up to JDK 1.4. However, I don't have a JDK 1.4 installed on my system (Mac). I get the following warning in Eclipse:

Build path specifies execution environment J2SE-1.4. There are no JREs installed in the workspace that are strictly compatible with this environment.

I have a JDK 8 installed that is compatible but Eclipse is not recognizing it. I don't want anything over 1.4 to enter this project. How do I go about configuring this?

1

There are 1 answers

13
eugenioy On BEST ANSWER

The project is probably configured to use JDK 1.4.

Since you don't have that one installed, you need to remove it and add the 1.8 you actually have.

  • Right click the project and select "Build Path" -> "Configure Build Path"
  • In the "Java Build Path" option, remove the "JRE 1.4"
  • Go to "Libraries" -> "Add Library" and add the JRE 1.8

Then you can configure the source compatibility to use 1.4 so that new features cannot be used.

  • "Build Path" -> "Configure Build Path"
  • Select "Java Compiler"
  • Configure "Source Compatibility" to be "1.4"