MapDB ClassNotFoundException: kotlin.jvm.internal.Intrinsics

后端 未结 4 1424
无人共我
无人共我 2020-12-17 03:36

I am trying to run a simple mapdb example, but get the error:

    Exception in thread \"main\" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics         


        
4条回答
  •  既然无缘
    2020-12-17 04:25

    Either kotlin-runtime has to be in classpath and verify with $ echo $CLASSPATH.

    Or you have to add kotlin-runtime to maven and then assemble inside the jar itself with mvn compile assembly:single,

    
        org.jetbrains.kotlin
        kotlin-runtime
        1.1.3
        compile
    
    
    
        org.jetbrains.kotlin
        kotlin-stdlib
        1.1.3
        compile
    
    

    which need to be attached to artifact as well and can be done with assembly-plugin.

        
            maven-assembly-plugin
            
                
                    
                        event.handlers.InventoryEventHandler
                    
                
                
                    jar-with-dependencies
                
            
        
    

    you can verify the kotlin-runtime is added to jar by

    $ jar -tf target/amz-wavelength-1.0-SNAPSHOT-jar-with-dependencies.jar | grep kotlin-runtime
    META-INF/kotlin-runtime.kotlin_module
    

    or

    $ jar -tf target/amz-wavelength-1.0-SNAPSHOT-jar-with-dependencies.jar | grep "kotlin/jvm/internal/*"
    

提交回复
热议问题