Getting Started with IntelliJ IDEA for Kotlin

Fetching Comments ...
Getting Started with IntelliJ IDEA for Kotlin

Getting Started with IntelliJ IDEA for Kotlin

This tutorial walks you through creating an easy Hello World application using IntelliJ IDEA.

Setting environment

In this tutorial, we have to use IntelliJ IDEA. To get started, install the most recent version of IntelliJ IDEA.

Kotlin is bundled with version 15 with the IntelliJ IDEA.

You can download the free community version (or the full-final version) from the JetBrains website.

As an alternative to using IntelliJ IDEA, you will compile and execute Kotlin applications using the instruction compiler. For details, see Working with the instruction compiler.

If you are new to JVM and Java, observe the JVM Minimal Survival Guide. If you are the new IntelliJ IDEA, then observe the IntelliJ IDEA Minimum Survival Guide.

Create a replacement project

Once you have the IntelliJ IDEA installed, it is time to build your first Kotlin application.

  1. Create a replacement project from a File -> New -> Select Kotlin | JVM | IDEA Project Type.

Kotlin New Project

  1. Give your project a name and choose an SDK version for it.

Kotlin Project Name

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

Kotlin Folder Structure

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

Kotlin New File

  1. Once the file is created, add the main function that is the entry point of the Kotlin application. IntelliJ IDEA provides a template to do this quickly. Just type main and press tab.

Kotlin Main Fun

  1. ‘Hello World!’ Add a line of code to print.

Kotlin Hello World

Application running

Now the application is ready to run. The easiest way is to click on the green run icon in the gutter and choose the run ‘app.kt’.

Kotlin Run App

If all goes well, you will see the result in the tool window.

Kotlin Run Output

congratulation! Now you have your first Kotlin application running.

Share This:

Featured Posts

post preview
post preview
post preview
post preview
post preview


Related Posts

Get The Best Of All Hands Delivered To Your Inbox

Subscribe to our newsletter and stay updated.