Daniel Svensson
04/18/2024, 10:50 AMVampire
04/18/2024, 11:21 AMDaniel Svensson
04/18/2024, 12:44 PMGabriel Feo
04/18/2024, 1:53 PMJAVA_HOME
when you run Gradle from a shell without the IDE. The build will still honor the toolchain choice when compiling Java (or Kotlin) sources, forking another java process with the toolchain JDK, independently from your "project SDK" or JAVA_HOME
(the Java and Kotlin plugins do that).Gabriel Feo
04/18/2024, 1:54 PM/usr/lib/jvm/zulu17
, JDK 17 must be pre-installed on that path. Toolchains won't install it.
Then, independently, if you set toolchain in your build logic to 21, the build (which is running on 17) will install 21 if necessary and use it to compile your Java/Kotlin sources in a separate JDK 21 process. Toolchains are also used to run your Java/Kotlin program by default.Vampire
04/18/2024, 3:05 PMAs far as I know, the "project SDK" in IDEA is what Gradle itself will run on,That depends on what settings you did. By default it uses
JAVA_HOME
as well to be consistent with the commandline execution.
And even if compilation is delegated to Gradle, the project sdk is very relevant for example for IntelliSense and language level.Daniel Svensson
04/18/2024, 3:23 PMVampire
04/18/2024, 4:37 PMjavaToolchains.launcherFor...
Daniel Svensson
04/18/2024, 4:47 PMVampire
04/18/2024, 4:59 PMVampire
04/18/2024, 5:01 PMVampire
04/18/2024, 5:03 PMVampire
04/18/2024, 5:05 PMDaniel Svensson
04/18/2024, 5:52 PM