Daemon does not use the correct JDK for compilation

When starting the Gradle daemon using the Tooling API, specifying the JDK home for the daemon seems to be ignored and the one executing the code of the Tooling API is used instead.

For example: If I use the Tooling API from JDK 1.6 and try to compile a code using Java7 apis (like ‘java.util.Objects’), compilation fails.

I have tried to set the JDK the following ways (even all of them at once): - Set JAVA_HOME. - Adding “-Dorg.gradle.java.home=…” as a JVM argument. - Specifying it through ‘BuildLauncher.setJavaHome’

I have checked the logs of the daemon and is says it is using it. I assume this from this log entry:

00:29:45.680 [DEBUG] [org.gradle.launcher.daemon.server.DomainRegistryUpdater] Advertised daemon context: DefaultDaemonContext[uid=46a67e4b-7f58-4989-afb9-00a43312e969,javaHome=C:\Program Files\Java\jdk1.7.0_05,daemonRegistryDir=C:\Users\Kelemen Attila.gradle\daemon,pid=3912,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1250]

I have came across GRADLE-2460 and due to the last comment on the issue, I have tried the latest build. It seems that this issue is fixed as I can no longer reproduce it with “gradle-1.3-20120917220018+0000”.

Thanks for letting us know.