You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better message when using wrong Java version #9215
When running bin/kc.sh with Java 8, I see error message with long stacktrace like this:
Exception in thread "main" java.lang.UnsupportedClassVersionError: io/quarkus/bootstrap/runner/QuarkusEntryPoint has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
...
This is fine for most of java developers, but someone not familiar with Java might be a bit lost with such message and will need to google to figure what's going on. Maybe it is better to use something more user-friendly like simple message: "Your Java version is too old. Please use Java 11 or newer. See command 'java -version' to figure what is your Java version".
Only way I know of on how to achieve a better msg here would be either to use an approach like here: https://github.com/rtyley/use-newer-java/ or add sth to the script that checks e.g. java -- version before invoking, but that would feel hacky - not sure this is really worth it, wdyt?
What about adding a specific "FAQ" or "Note" to the documentation so that it will get indexed and immediately available when someone will Google for it?
@pedroigor getting below error unable to start the server
`$ ./bin/kc.sh start-dev --http-port=8180
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/keycloak/quarkus/runtime/KeycloakMain 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.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:105)
at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:65)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:60)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:32)
`
I am using Java 20.
$ java --version
java 20.0.1 2023-04-18
Java(TM) SE Runtime Environment (build 20.0.1+9-29)
Java HotSpot(TM) 64-Bit Server VM (build 20.0.1+9-29, mixed mode, sharing)
Activity
DGuhr commentedon Apr 27, 2022
Only way I know of on how to achieve a better msg here would be either to use an approach like here: https://github.com/rtyley/use-newer-java/ or add sth to the script that checks e.g. java -- version before invoking, but that would feel hacky - not sure this is really worth it, wdyt?
andreaTP commentedon Apr 27, 2022
What about adding a specific "FAQ" or "Note" to the documentation so that it will get indexed and immediately available when someone will Google for it?
pedroigor commentedon Jun 7, 2022
Not priority.
nmanthena18 commentedon Jul 13, 2023
@pedroigor getting below error unable to start the server
`$ ./bin/kc.sh start-dev --http-port=8180
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/keycloak/quarkus/runtime/KeycloakMain 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.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:105)
at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:65)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:60)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:32)
`
I am using Java 20.
$ java --version
java 20.0.1 2023-04-18
Java(TM) SE Runtime Environment (build 20.0.1+9-29)
Java HotSpot(TM) 64-Bit Server VM (build 20.0.1+9-29, mixed mode, sharing)
pedroigor commentedon Jul 13, 2023
The message is stating you are using JDK11 as per the class file version 55.0.
Check if your JAVA_HOME is properly set ...
nmanthena18 commentedon Jul 13, 2023
@pedroigor - Sorry my bad!
nmanthena18 commentedon Jul 13, 2023
@pedroigor is there any document or tutorial how to run the keycloak from source code in ecilipse/vscode, I don't fine useful docs anywhere.
pedroigor commentedon Jul 13, 2023
Np. The best we have is https://github.com/keycloak/keycloak/blob/main/CONTRIBUTING.md.