Kotlin is currently for Java 6 and 8 only.
See frequently asked questions here https://kotlinlang.org/docs/reference/faq.html#does-kotlin-only-target-java-6
Who is currently talking
Kotlin only targets Java 6? No. Kotlin allows you to choose between bytecode generation compatible with Java 6 and Java 8. For higher versions of the platform, a more optimal bytecode can be generated.
Editing:
So ... since the compatibility of the bytecode that kotlin generates does not mean that the version of Java that you need to use is fixed.
Here's a gradle file that allows you to use Java 11 with kotlin generating Java 8 compatible bytecode
plugins { id 'java' id 'org.jetbrains.kotlin.jvm' version '1.2.71' } group 'com.dambra.paul.string-calculator' version '0.0.0' sourceCompatibility = 11.0 repositories { mavenCentral() } dependencies { testImplementation( 'org.junit.jupiter:junit-jupiter-api:5.1.0' ) testRuntimeOnly( 'org.junit.jupiter:junit-jupiter-engine:5.1.0' ) testCompile("org.assertj:assertj-core:3.11.1") testCompile 'org.junit.jupiter:junit-jupiter-params:5.1.0' compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" } compileKotlin { kotlinOptions { jvmTarget = "1.8" } } compileTestKotlin { kotlinOptions { jvmTarget = "1.8" } }
You cannot "target the JVM 9" with Kotlin. But you can write Kotlin along with Java (9 | 10 | 11 | etc.)
source share