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

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?


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"
  • 链接地址: http://www.djcxy.com/p/73832.html

    上一篇: 将jfxrt.jar添加到标准的Eclipse构建路径

    下一篇: 如何在Eclipse项目中指定旧的JDK合规性?