When you write an application in Java, you get to rely on all of the standard class libraries. The java.
classes (e.g. java.lang.*
, java.util.*
...) are included with every JRE, so you don't need to package them yourself.
Kotlin includes its own standard class library (the Kotlin runtime), separate to the Java class library. To distribute a jar file that can be run by anyone with a plain old JRE, you need to bundle the Kotlin runtime as well.
If you didn't bundle the Kotlin runtime, then your user would have to ensure the Kotlin runtime was on the classpath when executing your application. The page you linked gives an example of this scenario:
Compiling a library
If you’re developing a library to be used by other Kotlin applications, you can produce the .jar file without including the Kotlin runtime into it.
$ kotlinc-jvm hello.kt -d hello.jar
If you're targeting other Kotlin users, then its reasonable to assume they'll already have the Kotlin runtime available to them. However, if you're trying to deploy an application for an end-user, then you want to include the Kotlin runtime so that your application is self-contained.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…