Why Kotlin needs to bundle its runtime after compiled? -
i'm trying understand underlying architecture, think getting wrong.
taking tutorial here example.
when do:
kotlinc-jvm hello.kt -include-runtime -d hello.jar
why it's needed bundle kotlin runtime jar if compiler converted code java bytecode?
when write application in java, rely on of standard class libraries. java.
classes (e.g. java.lang.*
, java.util.*
...) included every jre, don't need package them yourself.
kotlin includes own standard class library (the kotlin runtime), separate java class library. distribute jar file can run plain old jre, need bundle kotlin runtime well.
if didn't bundle kotlin runtime, user have ensure kotlin runtime on classpath when executing application. page linked gives example of scenario:
compiling library
if you’re developing library used other kotlin applications, can produce .jar file without including kotlin runtime it.
$ kotlinc-jvm hello.kt -d hello.jar
if you're targeting other kotlin users, reasonable assume they'll have kotlin runtime available them. however, if you're trying deploy application end-user, want include kotlin runtime application self-contained.
Comments
Post a Comment