Warning: [options] bootstrap class path not set in conjunction with -source 1.6

I have a multi project build which should use different Java version. That I have set a different sourceCompatibility. Have set the flag fork = true. The different Java versions are installed but it seems to use only one Java version for all scripts.

How can I use different Java versions for compiling in one project. With ANT was this not a problem.

It’s just a warning, and it’s emitted by javac (not Gradle). For details, please see previous answers to similar questions here or on Stack Overflow.

The warning come from javac. This is right but it means that gradle is using the wrong JDK. Of course I have read previous answers.

I interpret your answer that gradle can find the right JDK self. Then I want add this as feature request for future versions.

I have add the follow to our base script. This solve the problem for all our scripts without any change. I had expected that gradle do this job for us.

 * Find the javac executable for the current sourceCompatibility. If the current JVM match then it return null.
String findJavacExecutable() {
    File javaHome = new File( System.getProperty( "java.home" ) )
    if( javaHome.getName().equals( "jre" ) ) {
        javaHome = javaHome.getParentFile()
    if( javaHome.getName().startsWith( "jdk${sourceCompatibility}" ) ) {
        return null
    File installDir = javaHome.getParentFile();
    for( File file : installDir.listFiles() ) {
        if( file.getName().startsWith( "jdk${sourceCompatibility}" ) ) {
            return new File( file, "bin/javac" ).getAbsolutePath()
    println "Warning: javac executable for ${sourceCompatibility} was not found."
    return null
  task findJavac {
    description '===
find and set the javac executable for the given sourceCompatibility ==='
    doLast {
        String executable = findJavacExecutable()
        if( executable != null ) {
            println "\tjavac: ${executable}"
            compileJava.options.fork = true
            compileJava.options.forkOptions.executable = executable

‘sourceCompatibility’ is equivalent to javac’s ‘-source’ flag. As such, Gradle isn’t using the wrong JDK. However, there is work underway to easily specify the JDK to be used in the build script.