8000 Better message when using wrong Java version · Issue #9215 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Better message when using wrong Java version #9215

Closed

Description

@pedroigor

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".

Activity

  1. added
    area/dist/quarkusQuarkus distribution — packaging, container images, server config (kc.sh)
    kind/enhancementCategorizes a PR related to an enhancement
    on Dec 17, 2021
  2. added this to the milestone on Feb 4, 2022
  3. modified the milestones: , 17.1.0 on Mar 8, 2022
  4. modified the milestones: 18.0.0, 19.0.0 on Mar 30, 2022
  5. DGuhr commented on Apr 27, 2022

    @DGuhr
    Contributor

    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?

  6. andreaTP commented on Apr 27, 2022

    @andreaTP
    Contributor

    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?

  7. pedroigor commented on Jun 7, 2022

    @pedroigor
    ContributorAuthor

    Not priority.

  8. Repository owner moved this from Todo to Done in Keycloak: Quarkus distributionon Jun 7, 2022
  9. nmanthena18 commented on Jul 13, 2023

    @nmanthena18

    @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)

  10. pedroigor commented on Jul 13, 2023

    @pedroigor
    ContributorAuthor

    The message is stating you are using JDK11 as per the class file version 55.0.

    Check if your JAVA_HOME is properly set ...

  11. nmanthena18 commented on Jul 13, 2023

    @nmanthena18

    @pedroigor - Sorry my bad!

  12. nmanthena18 commented on Jul 13, 2023

    @nmanthena18

    @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.

  13. pedroigor commented on Jul 13, 2023

    @pedroigor
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/dist/quarkusQuarkus distribution — packaging, container images, server config (kc.sh)kind/enhancementCategorizes a PR related to an enhancement

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0