Signup/Sign In

First Program in Kotlin using IntelliJ IDEA

In the last tutorial, we saw how to install IntelliJ idea in our system. In this tutorial, we will see how to create a new project in IntelliJ IDEA IDE and run our first program in Kotlin which will print "Hello World" on the console.

Create a new project in IntelliJ IDEA

Setting up a project in IntelliJ is necessary to run any Kotlin file. Follow these steps to create a new project:

  • Go to start, search IntelliJ IDEA, and open it. If you are running it the first time you might see some first-time settings like import settings and select a dark or normal theme. Choose it accordingly.

  • Next, you'll see this window:
    First program in Kotlin

  • Click on "Create New Project".

  • Choose Kotlin from the left side panel and select "JVM| IDEA" option. Click on next.
    First program in Kotlin

  • Enter the name of the project. You can edit the project location and provide a custom location.
    First program in Kotlin

  • On the left side, you can see the project structure like this:
    First program in Kotlin

  • Right click on src folder and select New > Kotlin File/Class and hit enter. You’ll see:
    First program in Kotlin

  • Enter file name "HelloWorld" and hit enter.

You have successfully created a new Kotlin project and a Kotlin file in it. Now we'll create our first Kotlin program in it.

First program in Kotlin

Write the following program is HelloWorld.kt file:

fun main() {
    println("Hello World")


  • Line 1: Every Kotlin program starts with the main() function. Functions are created using the fun keyword in Kotlin. We'll read more about functions in later sections.

  • Line 2: println() function is used to print strings on the console.

To run this program click on the green arrow just beside main() function as shown here:

First program in Kotlin

The program will be compiled and output will be printed on the console:

First program in Kotlin


In this article, we created a Kotlin project and run our first program in Kotlin. In the next tutorial, we see how to run the same program through the command line.

About the author:
I'm a writer at