Kotlin LanguageLevel init error


What's inside this article ⌄
  • Kotlin languagelevel initialization error
  • Could not initialize languagelevel
  • Kotlin language level class error
  • Fix Kotlin initialization error

If you’re facing this error:

java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.ExceptionInInitializerError [in thread "RMI TCP Connection(2)- 127.0.0.1"]

Double check, that you are using correct version of JDK while building your app. You may have:

sourceCompatibility = JavaVersion.VERSION_1_9
jvmTarget = JavaVersion.VERSION_1_9

but actually use JDK 19. This will cause the errors, described above.

Remember, that there are two places to check in IntelliJ IDEA:

  1. The first is: File → Project Structure → Project → SDK
  2. The second is: Settings → Build, Execution, Deployment → Gradle → GradleJVM. Details are here.