Dependency requires at least JVM runtime version 17. This build uses a Java 11 JVM.

mahabub.devs3
Mahabubur Rahman
Published on Nov, 09 2024 2 min read 0 comments
image

It looks like your project requires Java 17, but your build environment is currently using Java 11. Here’s how you can resolve this issue by updating your environment to use Java 17:

Step 1: Install Java 17

Update Package List: Open a terminal and run:

 

sudo apt update

Install OpenJDK 17: Install Java 17:

 

sudo apt install openjdk-17-jdk

Verify Installation: Check the Java version:

 

java -version

Step 2: Configure Java 17 in IntelliJ

Open IntelliJ: Launch IntelliJ IDEA.

Project Structure: Go to File > Project Structure.

Project SDK: Under Project Settings, select Project and then set the Project SDK to Java 17. If Java 17 is not listed, click New... and navigate to the JDK 17 installation directory.

Project Language Level: Ensure the Project language level is set to at least 17.

Step 3: Configure Gradle to Use Java 17

Gradle Properties: Open your build.gradle file and ensure that the sourceCompatibility and targetCompatibility are set to 17:

 

plugins {
    id 'org.springframework.boot' version '3.3.5'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
    sourceCompatibility = '17'
    targetCompatibility = '17'
}

Gradle JVM: Go to File > Settings > Build, Execution, Deployment > Build Tools > Gradle and ensure that Gradle JVM is set to JDK 17.

Step 4: Refresh Gradle Project

Refresh Gradle: In the Gradle tool window in IntelliJ, click the refresh button to reload the Gradle project with the new settings.

Step 5: Rebuild Project

Rebuild Project: Go to Build > Rebuild Project to rebuild the project with the updated Java version.

These steps should resolve the issue and allow your project to use Java 17. If you encounter any further issues, feel free to ask!

0 Comments