In my Quarkus 3.1.1.Final application I am using Java 17, which is configured in the POM file.
Normally I use the Quarkus CLI and execute quarkus dev
or quarkus test
while developing.
After upgrading I noticed that these commands no longer work and give the following error:
Exception in thread "main" java.lang.RuntimeException: java.lang.UnsupportedClassVersionError: org/apache/camel/quarkus/core/devmode/CamelHotReplacementSetup has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:137)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: java.lang.UnsupportedClassVersionError: org/apache/camel/quarkus/core/devmode/CamelHotReplacementSetup has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:506)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1210)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1221)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1265)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385)
at io.quarkus.deployment.dev.IsolatedTestModeMain.setupRuntimeCompilation(IsolatedTestModeMain.java:73)
at io.quarkus.deployment.dev.IsolatedTestModeMain.accept(IsolatedTestModeMain.java:123)
at io.quarkus.deployment.dev.IsolatedTestModeMain.accept(IsolatedTestModeMain.java:34)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
It seems that the Quarkus CLI uses Java 11 (55.0) for its execution, even though I have configured Java 17 (61.0).
I have verified my configuration using mvn clean verify
, mvn compile quarkus:dev
and mvn compile quarkus:test
which all build successfully.
Also in IntelliJ I am able to run all tests or individual tests successfully using Java 17.
The application runs in a Java 17 based Docker container without any problems.
The problem here is that Quarkus CLI seems to choose a different Java version.
What is the reason Quarkus CLI choses Java 11 instead of Java 17?
How can I configure Quarkus CLI to use the same Java version as Maven?
Is there anything to learn about the difference between the Maven commands and Quarkus CLI?