I just started having a weird issue after updating A JDK I DON’T USE from 15 to 16 ```ribesg:myProje...
r
I just started having a weird issue after updating A JDK I DON’T USE from 15 to 16
Copy code
ribesg:myProject/ (develop) $ ./gradlew

> Task :buildSrc:compileKotlin FAILED
e: No class roots are found in the JDK path: /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSrc:compileKotlin'.
> Compilation error. See log for more details

* 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 1s
ribesg:myProject/ (develop) $ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    16 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 16" /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
    11.0.10 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
    1.8.0_282 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
ribesg:myProject/ (develop) $ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Something seem to be looking for the JDK 15 which no longer exists now that it has been updated to 16. I verified using logs I added to my
gradlew
scripts that it’s calling my JDK 11's java. What references the JDK 15 here? Does the kotlin compiler/plugin itself has some kind of cache ? I removed
.gradle
and
build
folders multiple times and stopped Gradle daemons
Ok I’m keeping this up in case anyone encounters the issue, but my problem was that
gradle --stop
actually only stops Gradle daemons of the same version, and the project Gradle version is different.
./gradlew --stop
fixed the issue. A reboot would have fixed the issue too.