The project can be run with 'Run' -> 'Run\'[PACKAGE.NAME].MainKt\'' in Intellij Idea IDE.
However, the I have tried several methods from Stack Overflow, the problem still exists as well as I built jar file, and when run the output jar file
jar -jar [JarFilePathInMyComputer].JarFile.jar
,it throws an Exception as below
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at [PACKAGENAME].MainKt.main(Main.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 1 more
My dependencies are
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation 'org.jetbrains.kotlin:kotlin-runtime:1.2.71'
implementation "com.google.code.gson:gson:2.8.5"
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
When I add artifacts, OutPut layout contains below kotlin libraries
Gradle: commons-code:commons-codec:1.11
Gradle: org.jetbrains.kotlin-stdlib-jdk8-1.3.21
Gradle: org.jetbrains.annaotations:13.0
Gradle: juniy.junit:4.12
Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.21
Gradle: org.jetbrains.kotlin-runtime:1.2.71
Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21
Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.21
My MANIFEST.MF us
Manifest-Version: 1.0
Main-Class: [PACKAGE.NAME].MainKt
Class-Path: [PACKAGE.NAME]
How can I fix it? I have tried several methods, but the same exception still throws.