Kotlin Installation

2. Kotlin Installation 2.1 Steps to install kotlin 2.2 Kotlin First Program


Steps to install kotlin

Kotlin runs on the JVM, it compiles to Java bytecodes and so there is a need to install JDK. It includes both Java runtime and development tools. There are several IDE available to run kotlin programs. We can also execute kotlin programs through command prompt. These are the steps to setup kotlin programming environment.

Step 1: Install the JDK

Download and install the latest version of JDK from Oracle OTN.
https://www.oracle.com/technetwork/java/javase/downloads/index.html

Step 2: Install IDE

There are several suitable IDE available for Kotlin, like Intellij, Netbeans, Sublime text, Vim, Eclipse. In this tutorial we are using Intellij. Here is the official Jetbrains website, download the suitable version.

https://www.jetbrains.com/idea/download/#section%20=%20windows

Once the Intellij has installed, launch the IDE.

start kotlin

These are the steps to set up a new project.

Step 1: Select "Create New Project".
Step 2: Under "Additional Libraries and Frameworks" section, select Kotlin/JVM and click "Next".


kotlin new project

Kotlin First Program

Step 1: Give a Project Name, select project location and click "Finish".
Step 2: Under your Kotlin project directory, create a new Kotlin File in "src" folder.

Suppose we create a new file name 'firstprogram.kt', and copy paste the following code.

// Kotlin First Program

fun main(args : Array<String>) {
    println("Welcome to Kotlin Tutorial!")
}

kotlin first program

Step 3: Run the above file and we will see this output in the console section.

Welcome to Kotlin Tutorial!








Read more articles


General Knowledge



Learn Popular Language