| Last Updated | 4 May 2017 |
In this tutorial we're going to use IntelliJ IDEA. For instructions on how to compile and execute Kotlin applications using the command line compiler, see Working with the Command Line Compiler.
If you are new to the JVM and Java, check out the JVM Minimal Survival Guide. If you are new to IntelliJ IDEA, check out the The IntelliJ IDEA Minimal Survival Guide.
Install a recent version of IntelliJ IDEA. Kotlin is bundled with IntelliJ IDEA starting from version 15. You can download the free Community Edition from JetBrains.
Create a New Project. We select Java Module and select the SDK. Kotlin works with JDK 1.6+. Also, select the Kotlin (Java) checkbox.
Give our project a name on the next step.
We should now have the new project created with the following folder structure:
Let's create a new Kotlin file under the source folder. It can be named anything. In our case, we will call it app.
Once we have the file created, we need to type the main routine, which is the entry point to a Kotlin application. IntelliJ IDEA offers us a template to do this quickly. Just type main and press tab.
Let's now add a line of code to print out 'Hello, World!'.
Now we can run the application. The easiest way is to click on the Kotlin icon in the gutter and select Run 'AppKt'.
If everything went well, we should now see the result in the Run tool window.
Congratulations! We now have our first application running.
© 2010–2018 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/docs/tutorials/getting-started.html