How to change the JDK version (and project jdk version) in eclipse

1. Run eclipse normally, open window-preferences-java

2. The following is to select installed jres, and the configured JDK variables will be displayed on the right. You can configure multiple different variables to correspond to different versions of JDK

3. The following is to find the JDK that has been installed in your system, click Add, a new window will pop up at this time, you can choose by default, just next


4. In this window, you can configure the basic information of JDK, firstly the JDK installation path, and secondly some parameters of JDK running "default vm arguments"


5. After the installation is successful, the following page will pop up

Problem:  Modify the project jdk version in eclipse;

Solution:  There are three places to be modified:
1. Java compiler (it should be the jdk compiler selected by the project):

There are two ways:
  1. Select the compiler of the entire eclipse:
    eclipse's window -> preferences -> java -> compiler;
    image
  2. Select the compiler of a single project:
    right-click on the project, properties -> java compiler, bind the compiler type at the project level;
    image

2. Java Build Path (it should be the writing environment configuration of the project):

  Right-click on the project, properties -> Java Build Path -> Libraries, select JRE System Library -> Edit, and select the desired jdk version;
  image

3. Modify the pom.xml configuration file of the maven project (should be the jdk compiler of the selected project, with the highest priority):

<!-- 配置maven版本及工程编译jdk版本以及目标项目的jdk编译版本 -->
    <build>
	    <plugins>
	      <plugin>
	        <artifactId>maven-compiler-plugin</artifactId>
	        <version>3.1</version>
	        <configuration>
	          <!-- Neo4j Procedures require Java 8 -->
	          <source>1.8</source>
	          <target>1.8</target>
	        </configuration>
	      </plugin>
	    </plugins>
	</build>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325769092&siteId=291194637