[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"global-header-tutorials-static":3,"article-java-version-mismatch-gradle":4,"initial-similar-fetch":22},[],{"alias":5,"title":6,"description":7,"content":8,"thumbnail":9,"keywords":10,"categories":16,"tags":19,"createdAt":21},"java-version-mismatch-gradle","Java Version Mismatch for Gradle Build","How to Fix Gradle Error: Dependency requires at least JVM runtime version 17. This build uses a Java 8 JVM","{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"In this tutorial, we are going to learn how to resolve the Java version mismatch issue for a Gradle build in a Spring Framework, Spring Boot project.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"Problem\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"When building a Spring Boot application with Gradle, we might encounter the following issue.\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"Dependency requires at least JVM runtime version 17. This build uses a Java 8 JVM\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"This is the Java version mismatch when running the following command in a Spring Boot application.\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\" .\u002Fgradlew build\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Why does this happen?\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"This is due to a disconnect or mismatch between the executable Java version and the \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"JAVA_HOME\"},{\"type\":\"text\",\"text\":\" environment variable.\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"While running \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"java -version\"},{\"type\":\"text\",\"text\":\" it might show that Java 17 is installed, the Gradle Wrapper (gradlew) specifically depends on the \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"JAVA_HOME\"},{\"type\":\"text\",\"text\":\" environment variable to locate the JDK. If \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"JAVA_HOME\"},{\"type\":\"text\",\"text\":\" is still pointing to an older Java 8 installation, the issue occurs with the build failing.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":2},\"content\":[{\"type\":\"text\",\"text\":\"How to Fix It\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Verify the Java version\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"First, let's verify the installed Java version\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"java --version\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"You can verify the active Java version installed as:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"readlink -f $(which java)\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Output:\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"\u002Fusr\u002Flib\u002Fjvm\u002Fjava-17-openjdk-amd64\u002Fbin\u002Fjava\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Note that the directory path will be \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"\u002Fusr\u002Flib\u002Fjvm\u002Fjava-17-openjdk-amd64\"},{\"type\":\"text\",\"text\":\" (excluding the \u002Fbin\u002Fjava ). \"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Make sure the Java version used to create a project matches the installed version.\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"If you haven't found the specific version, download the JDK-specific version from the \"},{\"type\":\"text\",\"marks\":[{\"type\":\"link\",\"attrs\":{\"href\":\"https:\u002F\u002Fwww.oracle.com\u002Fjava\u002Ftechnologies\u002Fjavase\u002Fjdk17-0-13-later-archive-downloads.html\",\"target\":\"_blank\",\"rel\":\"noopener noreferrer nofollow\",\"class\":null,\"title\":null}}],\"text\":\"Java archive \"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Update the bashrc file\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Lets setup the JAVA_HOME path. Here, we are using Ubuntu, so let's do it on it.\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Open the \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"bashrc\"},{\"type\":\"text\",\"text\":\" file\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"sudo vi ~\u002F.bashrc\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Add the following setup \"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"export JAVA_HOME=\u002Fusr\u002Flib\u002Fjvm\u002Fjava-17-openjdk-amd64\\nexport PATH=$PATH:$JAVA_HOME\u002Fbin\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Make sure to use the exact path of JDK; in our case, it is inside \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"\u002Fusr\u002Flib\u002Fjvm\u002Fjava-17-openjdk-amd64\"},{\"type\":\"text\",\"text\":\" \"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"If you are using the old JAVA_HOME setup, update it with the new version of Java so the mismatch issue will be resolved.\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Apply the changes\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Save the file, press \"},{\"type\":\"text\",\"marks\":[{\"type\":\"code\"}],\"text\":\"Esc\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\":wq!\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Reload the changes\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Now reload the changes\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"source ~\u002F.bashrc\"}]},{\"type\":\"heading\",\"attrs\":{\"textAlign\":null,\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"Verify the changes\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\"echo $JAVA_HOME\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Now the setup is completed. You can check by running the Gradle Spring Boot project.\"}]},{\"type\":\"codeBlock\",\"attrs\":{\"language\":\"bash\"},\"content\":[{\"type\":\"text\",\"text\":\".\u002Fgradlew clean build\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":null},\"content\":[{\"type\":\"text\",\"text\":\"Your Gradle wrapper will now use the setup JDK 17, resulting in a version mismatch issue.\"}]}]}","\u002Fuploads\u002Fthumbnails\u002Fa4c6c910-5623-4db9-93f5-a515135adb99_gradle_version_mismatc.jpeg",[11,12,13,14,15],"gradle","java","spring-boot-4","spring-framework-7","spring",[17,18],"Spring Framework","Spring Boot",[15,12,20],"spring-boot","2026-06-09T12:15:21.729Z",[23,30,36,41,47,53,59],{"alias":24,"title":25,"description":26,"thumbnail":27,"createdAt":28,"tutorialAlias":29,"lessonAlias":29},"constructor-confusion-in-spring","Constructor Confusion in Spring Framework","Constructor Confusion and how to handle it in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fd0f09fc0-e1f9-49d1-bf9a-7d1c41050196_di_confusio.jpeg","2026-05-21T14:13:31.437Z",null,{"alias":31,"title":32,"description":33,"thumbnail":34,"createdAt":35,"tutorialAlias":29,"lessonAlias":29},"dependency-pull-lookup-spring","Dependency Pull and Contextualized Dependency Lookup in Spring Framework","Dependency Pull and Contextualized Dependency Lookup IoC Types in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fd1132443-313b-4dce-b713-55f356ef6051_depndency_pull.png","2026-05-20T15:26:06.494Z",{"alias":37,"title":38,"description":38,"thumbnail":39,"createdAt":40,"tutorialAlias":29,"lessonAlias":29},"types-of-dependency-injection-spring","Types of Dependency Injection in Spring Framework","\u002Fuploads\u002Fthumbnails\u002Fafb32399-6dda-41c4-b07c-7decb8257bbb_di_constructor_sette.jpeg","2026-05-19T17:01:51.972Z",{"alias":42,"title":43,"description":44,"thumbnail":45,"createdAt":46,"tutorialAlias":29,"lessonAlias":29},"spring-framework-project-for-gradle-with-intellij-idea","How to create a clean Spring Framework project for Gradle with IntelliJ IDEA","Create a clean Spring Framework project for Gradle with IntelliJ IDEA","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F0e4abad5-17e2-4311-8cf0-7d8f67af975a_spring-framework.png","2026-05-19T10:28:20.866Z",{"alias":48,"title":49,"description":50,"thumbnail":51,"createdAt":52,"tutorialAlias":29,"lessonAlias":29},"spring-dependency-injection-and-inversion-control","Dependency Injection (DI) and Inversion of Control (IoC) in Spring","Mastering Dependency Injection (DI) and Inversion of Control (IoC) in Spring: A Practical Guide for Building a Notification System","\u002Fuploads\u002Fthumbnails\u002F53c64b94-f188-40b4-9ae9-ad97612d688b_spring_d.jpeg","2026-05-19T05:31:45.138Z",{"alias":54,"title":55,"description":56,"thumbnail":57,"createdAt":58,"tutorialAlias":29,"lessonAlias":29},"setting-nginx-ssl-for-spring-boot-application","Setup Nginx and SSL for Spring Boot Application","Setting Nginx as a reverse proxy in our Spring Boot application","\u002Fuploads\u002Fthumbnails\u002F5433c987-9e86-4d90-9cce-a831d1598ba4_spring-boot-nginx.png","2026-05-04T05:36:23.075Z",{"alias":60,"title":61,"description":62,"thumbnail":63,"createdAt":64,"tutorialAlias":29,"lessonAlias":29},"deploy-spring-boot-application-with-docker","Deploy Spring Boot Application with Docker on Ubuntu Server","The ultimate guide to deploying our Spring Boot application with Docker on an Ubuntu server","https:\u002F\u002Fapi.csbyte.com\u002Fuploads\u002Feditor\u002F55a11844-d1e9-4e83-80e5-c6bb6df7d58b_intellij-idea-build.png","2026-05-03T05:58:55.642Z"]