Skip to content

NoClassDefFoundError on Java 11 #300

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
breandan opened this issue Jul 24, 2022 · 1 comment
Open

NoClassDefFoundError on Java 11 #300

breandan opened this issue Jul 24, 2022 · 1 comment

Comments

@breandan
Copy link

I recently tried upgrading from JVM version 1.8 to 11 by setting kotlinOptions.jvmTarget = "11", however I encountered the following error when using this library:

    java.lang.NoClassDefFoundError: org/jetbrains/kotlin/cli/jvm/plugins/ServiceLoaderLite
        at com.tschuchort.compiletesting.AbstractKotlinCompilation.getResourcesPath(AbstractKotlinCompilation.kt:219)
        at com.tschuchort.compiletesting.AbstractKotlinCompilation.compileKotlin(AbstractKotlinCompilation.kt:194)
        at com.tschuchort.compiletesting.KotlinCompilation.compileJvmKotlin(KotlinCompilation.kt:488)
        at com.tschuchort.compiletesting.KotlinCompilation.compile(KotlinCompilation.kt:664)
...

        Caused by:
        java.lang.ClassNotFoundException: org.jetbrains.kotlin.cli.jvm.plugins.ServiceLoaderLite
            at com.tschuchort.compiletesting.AbstractKotlinCompilation.getResourcesPath(AbstractKotlinCompilation.kt:219)
            ... 5 more
@tschuchortdev
Copy link
Owner

Please send the output of gradle dependencies task and gradle files for relevant modules. I tried it just now with

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "11"
    }
}

and a JDK 11 and it worked fine.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants