How to change the JDK version for an Eclipse project

I need to write a project that is compatible only with Java 1.5. I have Java 1.6 installed. Is there some form of backward compatibility to get Eclipse to compile with 1.5?

Should I install Java 1.5 to show it here? Or maybe there is another way?

Enter image description here .

+66
java eclipse jar
Sep 25 '12 at 17:58
source share
9 answers

Click the Add Library button. As a result, your screen will indicate the location of Java.

Select " Directory ", click the button to the right of JRE home and specify the location of the installed folder.

Although you only want a 1.5 compiler project, you can achieve this by changing the compiler settings in Eclipse instead of removing 1.6 JREs and adding 1.5 JREs.

GOTO -->JAVA--Compiler---> and change compiler level to '1.5' instead of '1.6' 

As Davidfmateson suggested,

Just be careful, especially if you're setting it up for a team of people to work on. If someone uses something new or changed in 1.6, it will compile, but will not work in an environment with JRE 1.5.

+48
Sep 25 '12 at 17:59
source share
β€” -

Go to the β€œWindow” tab in Eclipse, go to β€œSettings” and, when this window appears, go to Java β†’ Installed JRE β†’ Execution Environment and select JavaSE-1.5. Then you need to go to the compiler and set the compiler to match level.

Changing JRE

Enter image description here

+21
Sep 25 '12 at 18:05
source share

Right-click the project -> Properties -> Java Build Path -> select the JRE System Library , click Modify and select the JDK or . JRE after, then click Java Compiler and select compiler compliance level to 1.8

enter image description here

enter image description here

enter image description here

+16
Sep 04 '15 at 15:20
source share

See the Configure JDK in Eclipse page. Using the add button, you can add another version of the JDK ...

+2
Sep 25 2018-12-18T00:
source share

The JDK (JAVA_HOME) used to run Eclipse is not necessarily used to compile your project.

To see which JRE you can choose for your project, check the settings:

General -> Java installed JRE

By default, if you did not add a JRE, only the one used to start Eclipse (which can be defined in your eclipse.ini ) will be declared.

You can add any other JRE, including one compatible with your project.

After that, you will need to check in the properties of your project (or in the general settings) which JRE is used, with what level of compliance:

Alt text
(source: standartux.fr )

+2
Dec 12 '13 at
source share

Eclipse - JDK Version Project Change -

If you want to change any jdk version of a specific project, than you need to click ---> Project β†’ JRE System Library β†’ Properties ---> Inside the class container (JRE System Library) change the execution of the Environment that you want, for example 1.7 or 1.8.

+2
Aug 25 '15 at 23:02
source share

If you are using the maven build tool, add the following properties to it and updating maven will solve the problem

 <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> 
+2
Oct 05 '18 at 15:19
source share

In the settings section under Java β†’ Installed JREs, click the Add button and go to the 1.5 JDK home folder. Then check this in the list and it will become standard for all projects:

enter image description here

+1
Sep 25
source share

As I came across this question a few minutes ago, if you are trying to open an existing project in an environment with a newer JDK, make sure you create the JDK version in Project Properties β†’ Fac Facets β†’ Java.

+1
Dec 17 '15 at 13:06
source share



All Articles