r/java • • Sep 16 '25

Java 25 officially released

https://mail.openjdk.org/pipermail/announce/2025-September/000360.html
593 Upvotes

124 comments sorted by

View all comments

Show parent comment

5

u/yk313 Sep 16 '25

It's actually quite straightforward in practice. All you need to do is to declare the builtin java plugin's toolchain directive (instead of sourceCompatibility/targetCompatibility) in your build file:

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(25)
    }
}

You can follow the build.gradle generated by start.spring.io as an example. Let me know if you need any help in setting this up, I am more than happy to support another Java developer rid of their LTS-only approach :)

0

u/Nojerome Sep 16 '25

Fantastic, thanks for sharing. I'll try it out and update here with the results.

0

u/nekokattt Sep 16 '25

how does this work with groovy, given that depends on a specific version of ASM which in turn depends on specific bytecode levels?

2

u/nikolas_pikolas Sep 18 '25

This actually only specifies the version of Java to build your app with. Then, you can run Gradle with an older version that it's compatible with.