lundi 24 août 2020

How to include kotlin-reflect.jar in the classpath

I am trying to call someObject::class.annotations but get an error in runtime:

Exception in thread "main" kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath

I tried including the reflection library inside my build.gradle.kts file in any of the different forms suggested on StackOverflow and am still getting this error!

In the dependencies block inside the gradle file I tried:

api(kotlin("reflect"))
runtimeOnly(kotlin("reflect"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.0")

Yet none of these solve the issue and there is no official documentation on how to include this jar inside the classpath.





Aucun commentaire:

Enregistrer un commentaire