"Error running javac.exe compiler" when using Buildship

Hello, I am migrating a project from Ant to Gradle.
I want to call the Ant Targets from within the Gradle Script.
In one of the tasks I use an external JDK for a Java-Compilation.
When I execute that task from the command line or in IntelliJ it works fine, but when I use Buildship (Gradle Tasks-View) I get the error:

Execution failed for task ‘[task]’.
Error running [path to javac.exe] compiler

When I run it with --stacktrace it says ~“file couldn’t be found or accessed”, referring to the javac.exe.
I triple checked that the path is correct. And as I said, when I run the exact same task outside Buildship it works fine.
My current assumption is that it is some kind of permission issue (am running Eclipse as Admin) or that Eclipse is locking the file (which would be weird, since using the ANT Target without Buildship works as well).
I am forced to make this work easily from within Eclipse, otherwise colleagues are going to say that we should stick with Ant “since it’s better”.
Any idea on what I could try?

ANT Target (let’s assume variables are being replaced properly):
<target name="CompileWithDebug" description="Kompilieren mit DebugInfos"> <javac encoding="Cp1252" destdir="${bin}" classpathref="compile-classpath" debug="on" includeantruntime="false" executable="${compilerExecutable}" fork="true"> <src path="${src};"/> <src path="${testSrc};"/> </javac> </target>

build.gradle.kts (using Kotlin DSL):

ant.importBuild(“build.xml”) {
“ant_$it”
}