Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Kotlin download do I need?

Tags:

kotlin

I'm getting started with Kotlin, and on the downloads page I see two different possibilities that look relevant for me:

  • kotlin-compiler
  • kotlin-native-windows

What's the difference? In what case would I need one or the other?

like image 993
Ryan Lundy Avatar asked May 28 '20 10:05

Ryan Lundy


Video Answer


2 Answers

Most probably you won't use CLI to compile, build and run Kotlin projects a lot. Well, maybe you'll need a standalone compiler a few times compiling "Hello world" when starting with this language. BTW, you can use https://try.kotlinlang.org to compile simple programs and play with the language without local installations.

But as you proceed, it won't be enough. Most Kotlin projects today use either Gradle or Maven. Gradle scripts could be written in Kotlin themselves. I recommend you taking this extra step and use build tools instead of standalone compiler, as it will simplify a lot if things in future. IntelliJ IDEA, the most popular IDE for Kotlin made by JetBrains, the company behind Kotlin, allows you to create Gralde-based Kotlin projects in a few clicks.

like image 126
madhead - StandWithUkraine Avatar answered Oct 04 '22 20:10

madhead - StandWithUkraine


Kotlin is a multi-platform language. It can be compiled to produce binaries compatible either with:

  • Java
  • JavaScript
  • A native platform (Windows, Linux, iOS, etc.)

Which compiler you should choose depends on your needs. If you don't need to make your code operate with a C library or a specific OS tool, I'd recommend the kotlin-compiler, so you'll get an app executable through Java, which (at least for now) produce more optimized programs, and also easily portable (install a jre on target computer and you're ready to execute your Kotlin program). Plus, you'll be able to use any Java lib you need in your kotlin program.

Note : Official documentation contains guides to get started:

  • Command line compiler for JVM
  • Command line compiler for native executables
like image 41
amanin Avatar answered Oct 04 '22 21:10

amanin