Eclipse is the most commonly used software development tool for Java developers, and Eclipse relies on JDK. Of course, in order to meet the needs of the project, sometimes we need to change the version of the JDK. Based on my actual experience, this article will introduce to you how to change the JDK version under Eclipse. This article takes the replacement of JDK1.8 to JDK1.6 as an example to illustrate.
method/step
Looking at the project, the original JDK used is 1.8.
Select the project and click "Build Path" -> "Configure Build Path" to enter the following interface.
Delete JDK1.8, click "Add Library" -> "JRE System Library", click the "Next" button, select jdk1.6, and click the "Finish" button.
At this point, you can see that jdk has changed from 1.8 to 1.6, click the "OK" button. At this point, the execution program will report the following error.
Select the project, right-click and select "Properties" to enter the project properties interface.
Click "Java Compiler", select "Compiler compliance level", change it to 1.6, and click the "OK" button. At this point, execute the program again, and it can be executed normally.