Edit Page

Getting Started with IntelliJ IDEA

Last Updated 23 April 2019
This tutorial walks you through creating a simple Hello World application using IntelliJ IDEA.

Setting up the environment

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.

To get started, 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.

Creating a new project

Once you have IntelliJ IDEA installed, it's time to create your first Kotlin application.

  1. Create a new Project from File | New. Select the Kotlin | JVM | IDEA project type.

    Kotlin New Project

  2. Give your project a name and select an SDK version for it.

    Kotlin Project Name

    Now you have the new project created with the following folder structure:

    Kotlin Folder Structure

  3. Create a new Kotlin file under the source folder. It can be named anything. Let's call it app.

    Kotlin New File

  4. Once the file is created, add the main function which is the entry point to a Kotlin application. IntelliJ IDEA offers a template to do this quickly. Just type main and press tab.

    Kotlin Main Fun

  5. Add a line of code to print out 'Hello, World!'.

    Kotlin Hello World

Running the application

Now the application is ready to run. The easiest way is to click the green Run icon in the gutter and select Run 'AppKt'.

Kotlin Run App

If everything went well, you'll see the result in the Run tool window.

Kotlin Run Output

Congratulations! You now have your first Kotlin application running.