Specifying alternate JDK for compile task

I need to be able to specify a JDK to use for a particular compile task other than the JDK/JVM used to create the process in which Gradle is running. The background is that the JDK 6 javac compiler has a bug that was only ever fixed in the JDK 7 javac compiler relating to covariant return types and interface inheritance. It is really just a compiler bug. You can compile the same code using JDK 7 compiler and run it on JDK 6.

compileJava {
  options.fork = true
  options.forkOptions.executable = "..." // insert path to javac