Not able to run jar file


Getting error with a very basic “hello world from jar” searched forum but not found any satisfactory solution

Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
        at MainfileKt.main(Mainfile.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
        at Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more

I am using all painful tools listed as below.

Kotlin (latest 1.2.41)
Gradle (4.7)
intellij community 2018.1

in my gradle i have added additional lines (please note i am not using any package)

    manifest {
        attributes (
                'Main-Class': 'MainfileKt'

Please note my structure is

------------>kotlin (Please note its NOT java)

my Mainfile.kt

fun main(args: Array<String>) {
    println("hello world")

I am super irritated trouble shoot and finding online what I am doing wrong but no luck (I hope my manage will allow me go back to java sooner)

Please also note that, when I am giving class name as just Mainclass in my manifest, while running jvm says that it can not find class called Mainclass, this proves atleast JVM is able to MainclassKt


Compiled kotlin program depends on the standard library. If you use Gradle, you might have noticed compile("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") dependency in build.gradle file.

So when you run the resulting jar, you either have to provide paths to your dependencies with -classpath java parameter, or — the other common approach — to pack all your dependencies in the resulting jar. The latter can be done manually or with the help of various Gradle plugins, take a look at this overview:

Also you can use the Application plugin to gather all dependencies and create a runner script.