Skip to content

Unsupported Java. Your build is currently configured to use Java 21.0.1 and Gradle 8.5. #27272

Description

@zq99299

Current Behavior

When executing the build, it prompts:

Unsupported Java. 
Your build is currently configured to use Java 21.0.1 and Gradle 8.5.

Possible solution:
 - Use Java 20 as Gradle JVM: Open Gradle settings 
 - Open Gradle wrapper settings, change `distributionUrl` property to use compatible Gradle version and reload the project

Expected Behavior

https:docs.gradle.org/8.5/userguide/compatibility.html The compatibility documentation for Gradle 8.5 states that running Gradle with JDK 21 is supported, but in actual usage, it still doesn't work.

I hope to be able to build and run it successfully.

Context (optional)

15:48:55: 正在执行 'build'> Task :compileJava FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s
15:48:57: 执行完成 'build'
Unsupported Java. 
Your build is currently configured to use Java 21.0.1 and Gradle 8.5.

Possible solution:
 - Use Java 20 as Gradle JVM: Open Gradle settings 
 - Open Gradle wrapper settings, change `distributionUrl` property to use compatible Gradle version and reload the project


Steps to Reproduce

gradle build

Gradle version

8.5

Build scan URL (optional)

No response

Your Environment (optional)

intellij idea 2023.2.5 + gradle 8.5 + jdk 21.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed:questionusage question or request for help

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions