I started a fresh project from https://start.spring.io/ and chose java 16 as a Framework. This is my build.gradle:
I have worked with java 11 and spring boot before so I had Java 11 installed.(I use IntelliJ as my Editor)
In order to start my new project, I upgraded my Java version and updated my Path/Java HOME:
I checked my java version:
And I tried a gradle clean/assemble.
Despite doing this, I still get this error when I launch my project:
"C:Program FilesJava jdk-11binjava.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:C:Program FilesIntelliJ IDEAlibidea_rt.jar=51260:C:Program FilesIntelliJ IDEAbin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath C:Reposuniteplus_backendbuildclassesjavamain;C:Reposuniteplus_backendbuildresourcesmain;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter-data-jpa2.5.36e57512b8907710566daf2b246c724de3e38ad14spring-boot-starter-data-jpa-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter-web2.5.32cb23f2928177eeb9be81036623f4350a86a433spring-boot-starter-web-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1mysqlmysql-connector-java8.0.26e5ec6610020a3084b7d32ee725d1650176f6b3demysql-connector-java-8.0.26.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter-aop2.5.345a790c9abe248865e0ad2d1f8622d55877eb4f7spring-boot-starter-aop-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter-jdbc2.5.3ffc2a4b05d901775e5a96cc73450a1d072baecfaspring-boot-starter-jdbc-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1jakarta.transactionjakarta.transaction-api1.3.3c4179d48720a1e87202115fbed6089bdc4195405jakarta.transaction-api-1.3.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1jakarta.persistencejakarta.persistence-api2.2.38f6ea5daedc614f07a3654a455660145286f024ejakarta.persistence-api-2.2.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.hibernatehibernate-core5.4.32.Final99a5e10bf455337014c190e141ec631e9ff71663hibernate-core-5.4.32.Final.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.dataspring-data-jpa2.5.341db71033651f476fbc62a485387a4e891ec9940spring-data-jpa-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-aspects5.3.9ee2c3f8f99e1f115f502a7e47e632b1ed229e766spring-aspects-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter-json2.5.310336b02e83756f916c0d9510555046cacfc2005spring-boot-starter-json-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter2.5.32e16fb3d63961548468a2cd70015d4b1be968fd4spring-boot-starter-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter-tomcat2.5.3bedcf69b9e83a0744d93e5672320039b55deffdspring-boot-starter-tomcat-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-webmvc5.3.9c3cd1f0bba2658995e887d2f0011ab9bd3da1773spring-webmvc-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-web5.3.988c920ec1bda67fea04daa8e16165777440df473spring-web-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-aop5.3.99bcad31a74e60d205500dd67d2220bd0195c63f8spring-aop-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.aspectjaspectjweaver1.9.7158f5c255cd3e4408e795b79f7c3fbae9b53b7caaspectjweaver-1.9.7.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.zaxxerHikariCP4.0.3107cbdf0db6780a065f895ae9d8fbf3bb0e1c21fHikariCP-4.0.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-jdbc5.3.918efdbd53c154a08e1854a6cff29c2becea04025spring-jdbc-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.hibernate.commonhibernate-commons-annotations5.1.2.Finale59ffdbc6ad09eeb33507b39ffcf287679a498c8hibernate-commons-annotations-5.1.2.Final.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.jboss.loggingjboss-logging3.4.2.Finale517b8a93dd9962ed5481345e4d262fdd47c4217jboss-logging-3.4.2.Final.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.javassistjavassist3.27.0-GAf63e6aa899e15eca8fdaa402a79af4c417252213javassist-3.27.0-GA.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1net.bytebuddybyte-buddy1.10.22ef45d7e2cd1c600d279704f492ed5ce2ceb6cdb5byte-buddy-1.10.22.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1antlrantlr2.7.783cd2cd674a217ade95a4bb83a8a14f351f48bd0antlr-2.7.7.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.jbossjandex2.2.3.Finald3865101f0666b63586683bd811d754517f331abjandex-2.2.3.Final.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.fasterxmlclassmate1.5.13fe0bed568c62df5e89f4f174c101eab25345b6cclassmate-1.5.1.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.dom4jdom4j2.1.3a75914155a9f5808963170ec20653668a2ffd2fddom4j-2.1.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.glassfish.jaxbjaxb-runtime2.3.45f3828d3a345ff3d8acb83f07ba04eccf59e15bbjaxb-runtime-2.3.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-context5.3.9887f4579ade4f47cf0102856f4f4c88eda8ec9d7spring-context-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-orm5.3.9db37587efd6525283b53c7adc8989095e9eabc27spring-orm-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.dataspring-data-commons2.5.326d822ee2bff03fb82e68c8a61be92f4994c9b56spring-data-commons-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-tx5.3.9a7057cf30368d014a1c8e5880a128703c890ec79spring-tx-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-beans5.3.948600db2cb1abc0f7ef2b073f0c1abd78a83bcfcspring-beans-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-core5.3.9cfef19d1dfa41d56f8de66238dc015334997d573spring-core-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.slf4jslf4j-api1.7.32cdcff33940d9f2de763bc41ea05a0be5941176c3slf4j-api-1.7.32.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.fasterxml.jackson.datatypejackson-datatype-jsr3102.12.4b1174c05d4ded121a7eaeed3f148709f9585b981jackson-datatype-jsr310-2.12.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.fasterxml.jackson.modulejackson-module-parameter-names2.12.487c4e9a3302f0fafe4e5587f9c27d22847d8fe00jackson-module-parameter-names-2.12.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.fasterxml.jackson.datatypejackson-datatype-jdk82.12.4858a1e1b677cbafd3b100d5154f491a7051401cjackson-datatype-jdk8-2.12.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.fasterxml.jackson.corejackson-databind2.12.469206e02e6a696034f06a59d3ddbfbba5a4cd81jackson-databind-2.12.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-autoconfigure2.5.3f03d7e9102d93ab25110da850be9facf11818a0bspring-boot-autoconfigure-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot2.5.3e25d2de9e166a8bbbfae633fc03220ab36ac19a9spring-boot-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-starter-logging2.5.3a3a2057be09b4105ecf2e7e3097e0e3fe2eb2684spring-boot-starter-logging-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1jakarta.annotationjakarta.annotation-api1.3.559eb84ee0d616332ff44aba065f3888cf002cd2djakarta.annotation-api-1.3.5.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.yamlsnakeyaml1.287cae037c3014350c923776548e71c9feb7a69259snakeyaml-1.28.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.apache.tomcat.embedtomcat-embed-websocket9.0.50eb8d0bedeb2a9ed61ea3b3790055e937e52898a3tomcat-embed-websocket-9.0.50.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.apache.tomcat.embedtomcat-embed-core9.0.5014307c487516ab3526213a1205c5243b0c484e8dtomcat-embed-core-9.0.50.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.apache.tomcat.embedtomcat-embed-el9.0.50ee4e14e128bf6ffe7650c7a5d8cedf97fb36d91btomcat-embed-el-9.0.50.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-expression5.3.9f5ca763cfb9d62d196efd5d25e8daca7d555ed75spring-expression-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1jakarta.xml.bindjakarta.xml.bind-api2.3.348e3b9cfc10752fba3521d6511f4165bea951801jakarta.xml.bind-api-2.3.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.glassfish.jaxbtxw22.3.4257fa649d3137a1060d222aefb96b7d1dd5f1286txw2-2.3.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.sun.istackistack-commons-runtime3.0.12cbbe1a62b0cc6c85972e99d52aaee350153dc530istack-commons-runtime-3.0.12.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframeworkspring-jcl5.3.9622eb12c98768b6d3acc71ce06bac8b332607a10spring-jcl-5.3.9.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.fasterxml.jackson.corejackson-annotations2.12.4752cf9a2562ac2c012e48057e3a4c17dad66c66ejackson-annotations-2.12.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.fasterxml.jackson.corejackson-core2.12.46a1bd259b6c4e3f9219ec8ec0be55ed11eed0cjackson-core-2.12.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1ch.qos.logbacklogback-classic1.2.4f3bc99fd0b226065012b24fe9f808299048bab54logback-classic-1.2.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.apache.logging.log4jlog4j-to-slf4j2.14.1ce8a86a3f50a4304749828ce68e7478cafbc8039log4j-to-slf4j-2.14.1.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.slf4jjul-to-slf4j1.7.328a055c04ab44e8e8326901cadf89080721348bdbjul-to-slf4j-1.7.32.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1ch.qos.logbacklogback-core1.2.45f429ee58dbacf9040f846f1218c36ca6e851596logback-core-1.2.4.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.apache.logging.log4jlog4j-api2.14.1cd8858fbbde69f46bce8db1152c18a43328aae78log4j-api-2.14.1.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1org.springframework.bootspring-boot-devtools2.5.3c1ebd2e92bcee4b3bd758795220eac1c44b5c28espring-boot-devtools-2.5.3.jar;C:UsersPatrick.gradlecachesmodules-2files-2.1com.sun.activationjakarta.activation1.2.274548703f9851017ce2f556066659438019e7eb5jakarta.activation-1.2.2.jar com.wegner.uniteplus.uniteplus_backend.UniteplusBackendApplication Error: LinkageError occurred while loading main class com.wegner.uniteplus.uniteplus_backend.UniteplusBackendApplication java.lang.UnsupportedClassVersionError: com/wegner/uniteplus/uniteplus_backend/UniteplusBackendApplication has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0
It seems that spring is still using my old java version. How can I fix this?
Advertisement
Answer
Change the javaversion used by Intellij by doing this:
Go to File > Project Structure and then under Project Settings > Project you will find the option to change your Projects Java Version (If you have other versions installed that is).