Springboot project error [Error: java: Error: Release version 17 is not supported]

Project scenario: An error occurred after the springboot project build was completed.

A Spring boot project built using IDEA's Spring Initializr runs with an error after the build is complete.

Problem Description

After using Spring Initializr to create a Spring Boot project, an error occurs when running.“错误:java: 错误: 不支持发行版本 17”
Error: java: Error: Release version 17 is not supported


Cause Analysis:

According to the error message, there should be a problem with the JDK version. Check pom.xml to check.

java version is 17

As you can see, the JDK version is 17. Since I have not installed JDK17, I will get an error saying that release version 17 is not supported. However, when I use Spring Initializr to create a project, I select JDK11. Why does it change to 17 after the creation is successful? Check the Spring Boot version here

Spring Boot version is 3.0.4

Now it's clear, it should be Spring Boot的版本和Java版本不兼容the problem. After checking Spring Boot 3.0.4支持的最低Java 版本为JDK 17, I found that I ignored the JDK version I specified when creating the project, and instead selected the lowest JDK that meets the conditions. And because I didn't install this version, I reported an error.


solution:

Just select a lower version of Spring Boot when creating the project

Choose a lower version of Spring Boot
The corresponding relationship between Spring Boot and JDK versions can be searched by yourself.

Guess you like

Origin blog.csdn.net/qq_51330798/article/details/129686073