Using both jdk 1.6 and jdk 1.7 for different projects in Eclipse

12,558

You can set overall workspace properties to use one version of Java and set individual project properties to use another.

  • To set overall workspace properties, click on Window > Preferences, then navigate to Java > Compiler.
  • To set project properties, right-click on the project and select Properties. Navigate to Java Compiler and check "Enable project specific settings"

You can choose from among the installed JREs for either setting. To tell Eclipse about a newly installed JRE, you can open the workspace preferences and navigate to Java > Installed JREs and then click the "Add" button.

Share:
12,558
Joey
Author by

Joey

Updated on June 08, 2022

Comments

  • Joey
    Joey almost 2 years

    I am using Eclipse with JDK 1.7. My previous projects are developed in java 7 and JDK 1.7. Now, I want to build a new project under JDK 1.6 in Eclipse. Is it possible to do that so that some projects are based on JDK 1.7 and some others are based on JDK 1.6 without conflicts?

    If this can be done, please let me know how to do it step by step.

    Update: My default JDK is 1.7. I created a new project that is based on jdk1.7 by default. And then I go to the property of this project, and then java compiler, then change the compliance settings as the image shows below. But there is some error occurred. What could be the reason causes this error?

    enter image description here

    enter image description here

    The following is the "problem" view

    enter image description here

    After some research, I have solved this problem. please see the reference about how to fix the facet version.