A Fix to the Error ‘java.lang.UnsupportedClassVersionError ’ in Spring Boot App when Running in IntelliJ IDEA
Introduction
This is one of the errors I encountered when I built and ran a Gradle Spring Boot Project configured with Java version 11 for the first time in my IntelliJ IDE. My IntelliJ IDE was first configured to run projects with Java 8. I came across two problems. The error in the title is my second problem. To be clearer and more helpful for beginners, I have mentioned the solution for the first problem in Section 1 and the solution for the second issue is mentioned in Section 2 of this article. For those who have the issue mentioned in the article's title, please refer to section 2.
Section 1
This is the first issue I came across when running the project.
Execution failed for task ‘:compileJava’.
> Could not target platform: ‘Java SE 11’ using tool chain: ‘JDK 8 (1.8)’.
Reason for the issue:
When compiling the project, the IDE tried to use JDK 8 ( which was already configured there) when my Spring Boot project was set to use Java SE 11.
How to resolve:
First, download Java SE JDK 11 and installed it in a preferred location (Remember this…