Kotlin compile error with JDK 11 (JDK 8 not available)

I am writing a gradle plugin with Kotlin.
I have JDK 11 set up on my machine.
When I build the plugin in my command line, it is failing at “compileKotlin” stage.

e: No class roots are found in the JDK path: C:\Program Files\RedHat\java-11-openjdk

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':plugin:compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

I would like to use kotlin with just JDK 11.
Please help me out here.

Can you show the exact command line command, and also your project file?

1 Like

Thanks for your reply.
There was a problem with my JAVA_HOME.
Once I corrected it, I did not face this issue anymore.