# Include kotlin standard in output jar

**URL:** <https://discuss.kotlinlang.org/t/include-kotlin-standard-in-output-jar/28117>\
**Category:** Support\
**Created:** [February 10, 2024, 1:12am UTC](https://discuss.kotlinlang.org/t/include-kotlin-standard-in-output-jar/28117 "2024-02-10T01:12:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![walksanatora](https://avatars.discourse-cdn.com/v4/letter/w/d78d45/32.png) [@walksanatora](https://discuss.kotlinlang.org/u/walksanatora)\
**Post date:** [February 10, 2024, 1:12am UTC](https://discuss.kotlinlang.org/t/include-kotlin-standard-in-output-jar/28117/1 "2024-02-10T01:12:56Z")

</div>

hello I am writing a simple kotlin application targeting the JVM using gradle I have no idea how to include kotlin so I can `java -jar myJar.jar`

---

<div class="post-metadata">

**Author:** ![walksanatora](https://avatars.discourse-cdn.com/v4/letter/w/d78d45/32.png) [@walksanatora](https://discuss.kotlinlang.org/u/walksanatora)\
**Post date:** [February 10, 2024, 1:13am UTC](https://discuss.kotlinlang.org/t/include-kotlin-standard-in-output-jar/28117/2 "2024-02-10T01:13:27Z")

</div>

my build.gradle

```groovy
plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.9.22'
    id "com.github.johnrengelman.shadow" version "7.1.2"
}

group = 'net.walksanator.uxnkt'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.jetbrains.kotlin:kotlin-test'
    implementation "org.jetbrains.kotlin:kotlin-stdlib"
}
jar {
    manifest {
        attributes 'Main-Class': 'net.walksanator.uxnkt.MainKt'
    }
}

test {
    useJUnitPlatform()
}
kotlin {
    jvmToolchain(17)
}

```

---

<div class="post-metadata">

**Author:** ![Skater901](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/skater901/32/10163_2.png) [@Skater901](https://discuss.kotlinlang.org/u/Skater901)\
**Post date:** [February 14, 2024, 11:04am UTC](https://discuss.kotlinlang.org/t/include-kotlin-standard-in-output-jar/28117/3 "2024-02-14T11:04:05Z")

</div>

You need to do one of two things.

1. Include your dependencies in your jar file, along with a location of where to find them on the computer. IE, you need a list that says “I require org.jetbrains.kotlin:kotlin-stdlib, and I will look for it in C:\Users\myUser.m2\repository\org\jetbrains\kotlin”
2. Use the Shadow plugin that you have in your build.gradle file to build a _shaded_ jar. One of your Gradle tasks should be something like “shadowJar”, and using that will produce a jar file that includes the Kotlin standard library inside it.

---

<div class="post-metadata">

**Author:** ![gidds](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/gidds/32/10865_2.png) [@gidds](https://discuss.kotlinlang.org/u/gidds)\
**Post date:** [February 15, 2024, 10:48pm UTC](https://discuss.kotlinlang.org/t/include-kotlin-standard-in-output-jar/28117/4 "2024-02-15T22:48:06Z")

</div>

> [@Skater901](#):
>
> build a _shaded_ jar.

Is that the same as a **fat** jar?

---

<div class="post-metadata">

**Author:** ![Skater901](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/skater901/32/10163_2.png) [@Skater901](https://discuss.kotlinlang.org/u/Skater901)\
**Post date:** [February 16, 2024, 1:00am UTC](https://discuss.kotlinlang.org/t/include-kotlin-standard-in-output-jar/28117/5 "2024-02-16T01:00:39Z")

</div>

Yep, I just call it a shaded jar in this case because as far as I know, they’re two different names for the same thing, but specifically Gradle has the _shadow_ plugin which creates _shaded_ jars. Seems weird to talk about a shadow plugin creating fat jars, y’know? 😛
