This message was deleted.
# community-support
s
This message was deleted.
v
s
So I installed java8, but now i need to figure out how to pint gradle to jdk8
I folowed the instructions to set up a sym mlink and add to zscrc
Copy code
sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk
Copy code
echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc
m
This is the canonical way to set the Java version; you would add this snippet to your convention plugin in `buildSrc`:
Copy code
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}
Beyond that, you just need to ensure that a JDK with the specified version is on your path when you run Gradle, though that's almost always taken care of when you install the JDK.
(Depending on the version of Gradle, you may need to use
languageVersion.set()
instead of
languageVersion =
.)
v
@Mike Wacker that's not particularly helpful. The topic here is about running Gradle with a Java version it is compatible with and for that JVM toolchains are pointless. 😉
@Swathi Balasubramanya Ayas you can also just set
JAVA_HOME
to what you want Gradle to use. Only if that environment variable is not set, the Java version from the
PATH
is used. You can simply check which version is used by running
./gradlew --version
s
Thank you! This helped me get a clean build.
👌 1