bootstrap class path not set in conjunction with -source 1.6

‹ Not actually eating oatmeal | WARNING: Class Joiner loaded from appengine.jar has a dependency which is not part of App Engine's supported API ›

Running a simple build.gradle file with sourceCompatibility = 1.6 with Oracle's JDK 1.7

apply plugin: 'java'
defaultTasks 'build'
sourceCompatibility = 1.6

repositories {
  mavenCentral()
}

dependencies {
  testCompile 'junit:junit:3.8'
}

will cause this warning to be emitted by the JVM:

[ERROR] [system.err] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[ERROR] [system.err] 1 warning

To fix it, you can set the bootClasspath option for your JVM to point at the rt.jar from a Java 1.6 distribution:

apply plugin: 'java'
defaultTasks 'build'
sourceCompatibility = 1.6

repositories {
  mavenCentral()
}

dependencies {
  testCompile 'junit:junit:3.8'
}

compileJava {
  options.bootClasspath = "/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rt.jar"
}

compileTestJava {
  options.bootClasspath = "/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rt.jar"
}

Subscribe to All Posts - Wesley Tanaka