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”
Cause Analysis:
According to the error message, there should be a problem with the JDK version. Check pom.xml to check.
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
Now it's clear, it should be
Spring Boot的版本和Java版本不兼容
the problem. After checkingSpring 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
The corresponding relationship between Spring Boot and JDK versions can be searched by yourself.