speed_star777
speed_star777

Reputation: 503

Which versions of Kotlin are compatible with which versions of Java?

I know Kotlin requires Java when running Kotlin. For example, I use Kotlin 1.4.0 and I use Java 14. However, I'm not sure about Kotlin and Java version compatibility.

Is there a Kotlin and Java version compatibility table?

I looked through the official document, but I couldn't find the information that I wanted.

Upvotes: 40

Views: 24781

Answers (2)

Michael
Michael

Reputation: 44210

Which versions of JVM does Kotlin target?

Kotlin lets you choose the version of JVM for execution. By default, the Kotlin/JVM compiler produces Java 8 compatible bytecode. If you want to make use of optimizations available in newer versions of Java, you can explicitly specify the target Java version from 9 to 23.

https://kotlinlang.org/docs/reference/faq.html#which-versions-of-jvm-does-kotlin-target

Upvotes: 27

k314159
k314159

Reputation: 11182

The following table shows the Kotlin compiler version that had first started supporting each new JVM target:

Kotlin version Release date JVM targets
1.0 15/2/2016 1.6 only
1.1 7/2/2017 1.6 to 1.8
1.3.30 11/4/2019 1.6 to 12
1.3.70 3/3/2020 1.6 to 13
1.4.0 14/8/2020 1.6 to 14
1.4.20 19/11/2020 1.6 to 15
1.5.0 26/4/2021 1.6 to 16
1.6.0 16/11/2021 1.8 to 17
1.6.20 4/4/2022 1.8 to 18
1.8.0 28/12/2022 1.8 to 19
1.9.0 6/7/2023 1.8 to 20
1.9.20 1/11/2023 1.8 to 21
2.0.0 21/5/2024 1.8 to 22
2.1.0 27/11/2024 1.8 to 23

Upvotes: 85

Related Questions