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

**URL:** <https://discuss.gradle.org/t/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-6/6351>\
**Category:** Old Forum Archive\
**Created:** [September 29, 2014, 11:05am UTC](https://discuss.gradle.org/t/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-6/6351 "2014-09-29T11:05:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Horcrux7](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/horcrux7/32/96_2.png) [@Horcrux7](https://discuss.gradle.org/u/Horcrux7)\
**Post date:** [September 29, 2014, 11:05am UTC](https://discuss.gradle.org/t/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-6/6351/1 "2014-09-29T11:05:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [September 29, 2014, 8:28pm UTC](https://discuss.gradle.org/t/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-6/6351/2 "2014-09-29T20:28:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Horcrux7](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/horcrux7/32/96_2.png) [@Horcrux7](https://discuss.gradle.org/u/Horcrux7)\
**Post date:** [September 30, 2014, 5:57am UTC](https://discuss.gradle.org/t/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-6/6351/3 "2014-09-30T05:57:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Horcrux7](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/horcrux7/32/96_2.png) [@Horcrux7](https://discuss.gradle.org/u/Horcrux7)\
**Post date:** [September 30, 2014, 6:57am UTC](https://discuss.gradle.org/t/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-6/6351/4 "2014-09-30T06:57:00Z")

</div>

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.

```gradle
/**
 * 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 ==='
    compileJava.dependsOn(findJavac)
    doLast {
        String executable = findJavacExecutable()
        if( executable != null ) {
            println "\tjavac: ${executable}"
            compileJava.options.fork = true
            compileJava.options.forkOptions.executable = executable
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [September 30, 2014, 11:19am UTC](https://discuss.gradle.org/t/warning-options-bootstrap-class-path-not-set-in-conjunction-with-source-1-6/6351/5 "2014-09-30T11:19:00Z")

</div>

‘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.
