|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.
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–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.