When a task needs access to toolchains without the java plugin being applied the toolchain service can be used directly.If an unconfigured toolchain spec is provided to the service, it will always return a tool provider for the toolchain that is running Gradle.This can be achieved by passing an empty lambda when requesting a tool: javaToolchainService.launcherFor().