Home  >  Article  >  Java  >  How to solve "java error invalid source release 17 problem" in SpringBoot project

How to solve "java error invalid source release 17 problem" in SpringBoot project

WBOY
WBOYforward
2023-05-09 11:55:084280browse

The springboot project appears "java: Error: Invalid source release version: 17" Problem solution

The following is the error page

How to solve java error invalid source release 17 problem in SpringBoot project

Problem analysis

In the case where I personally encountered this problem, the reason for this error was that the version of springboot was inconsistent with the version of java

After the spring3 update, idea will select spring3 by default when creating a springboot project , even if you choose the version of java8

How to solve java error invalid source release 17 problem in SpringBoot project

idea defaults to spring3

How to solve java error invalid source release 17 problem in SpringBoot project

When you create spring3 with java8 After completing the project, "java: Error: Invalid source release version: 17" will definitely appear. If you search this problem on Baidu, it will only let you change the jdk version of your project as follows

How to solve java error invalid source release 17 problem in SpringBoot project

How to solve java error invalid source release 17 problem in SpringBoot project

However, changing it has no effect. When you start the springboot project, it will change back to the java17 corresponding to spring3

Solution

To fix this bug without re-creating the project, we only need to open the pom file and modify the springboot version it specifies. Remember that the latest stable spring2 version is the version at the bottom of the drop-down box when you create the spring project, which is 2.7.11 , and then the pom also specifies the java version, we also need to change it to 8

How to solve java error invalid source release 17 problem in SpringBoot project

Modified pom file

How to solve java error invalid source release 17 problem in SpringBoot project

After that, our spring project bug will be fixed

How to solve java error invalid source release 17 problem in SpringBoot project

The above is the detailed content of How to solve "java error invalid source release 17 problem" in SpringBoot project. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete