Which Option to Choose?
Kotlin doesn’t dictate which option you choose to run the code; it’s entirely up to you, depending on your needs and liking. Here are a few things to consider when choosing your option:
-
To intermix Kotlin code with Java or other languages on the JVM, compile the code using kotlinc-jvm. Then, simply throw the jar file into the classpath or modulepath along with a reference to the kotlin-stdlib.jar file, and use it like you’d use any jar created from Java source code using javac.
-
If you have multiple Kotlin files and intend to run the program as a Kotlin program, then use the kotlin tool to run the code.
-
To implement system-level or back-end tasks using Kotlin, create a single Kotlin file and run it as script using the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access