hey guys: - using java 20, trying to play with pro...
# gradle
g
hey guys: • using java 20, trying to play with project panama • using kotlin • built some code with rust • want: use gradle to compile some kotlin running against java 20 with
java.lang.foreign
(an --enable-preview in java 20) I have this very strange behaviour where intelliJ (with a gradle imported project) is able to find
java.lang.foreign
, but gradle is not. I do have gradle itself running on java 17, (I Believe), and I've used `
Copy code
languageVersion.set(JavaLanguageVersion.of(20))
in addition to
Copy code
org.gradle.java.installations.paths=C:/Program Files/Zulu/zulu-20-ea
but gradle still seems to be compiling with javac from java-17. Any help?
bah, I just found
Copy code
kotlin {
    jvmToolchain {
        languageVersion.set(JavaLanguageVersion.of(20))
but it blows up expecting a maximum of 18 😧
i guess... does a beta gradle 8.0.0 support java 20?
t
better to ask it in Gradle community slack
for Kotlin specifically you could try to use:
Copy code
tasks.withType<UsesKotlinJavaToolchain>().configureEach {
    kotlinJavaToolchain.jdk.use(
        "/path/to/local/jdk20", // Put a path to your JDK
        JavaVersion.VERSION_20
    )
}
g
@tapchicoma thanks, i didnt get back but this worked. I specified that I wanted java 20 and then added a 'custom" java 20 to the toolchain in a config file somewhere (any readers, ping me and ill dig it up for you)
166 Views