Kotlin Tutorial Beginner Guide for Kotlin Programming Language Tutorial

Install Kotlin and Developer tools in Windows OS

In this article, we are going to create our Kotlin development environment in Windows Operating System.

Below are the articles for installation steps in Mac and Linux

Step 1: Install Java

Kotlin is a JVM language and the compiler will emit Java bytecode. Because of this, we are going to install Java JDK. Visit below URL and download Java JDK.

Download Java JDK

Below images show the JDK Installation Steps in Windows

      

For ensuring our Java is Installed Correctly we are going to check the Java Version for this open Command prompt and execute “java --version”.

Below images shows the output for “java --version” command.

Windows Command Prompt Check Java Version

Windows Command Prompt Check Java Version

Step 2: Install Kotlin Compiler

Now JDK is installed we first going to download and Install Kotlin Compiler

Download Kotlin Compiler

Extract the Zip file

Extract Kotlin Compiler

Extract Kotlin Compiler

Now we ready to use Kotlin Compiler.

Use Command Line Compiler to compile Kotlin Code

First, we are going to write a Hello vLemonn code. Then we are going to compile it using Kotlin Command Line Compiler. And in the last, we are going to run our compile code.

For writing code, we are going to use notepad.

  • Open Notepad. Past below code in notepad
fun main(args: Array<String>) {
	println("Hello, vLemonn!")
}
  • Save your code in HellovLemonn.kt file (File extension is .kt)
  • Open  Kotlin Compiler folder. <Extracted Path for Kotlin Compiler>\kotlin-compiler-1.2.0\kotlinc\bin. Open Command Prompt with this path

Kotlin Compiler

Kotlin Compiler

  • Execute command in Kotlin Compiler “kotlinc "C:\Users\Mayank Sanghvi\Documents\HellovLemonn.kt" -include-runtime -d "C:\Users\Mayank Sanghvi\Documents\HellovLemonn.jar"
  • Our compile code is available at C:\Users\Mayank Sanghvi\Documents\HellovLemonn.jar

Let’s execute above jar file. Command “java -jar "C:\Users\Mayank Sanghvi\Documents\HellovLemonn.jar".

 

Below is the output

Step 3: Install IDE for Kotlin

Now we know about how to use Kotlin Compiler. It’s time to check IDE for Kotlin. Kotlin is developed by JetBrains so it is Supported by IntelliJ IDEA. We are going to use IntelliJ IDEA Community edition in our entire tutorial series. IntelliJ IDEA community edition is free to use. But if you want to use Eclipse IDE, then we are going to learn how to enable Kotlin plugin for Eclipse.

Visit below URL to download IntelliJ IDEA for Windows

Download IntelliJ IDEA

IntelliJ IDEA Setup is very easy. Double click on the downloaded setup file. Follow the instructions. Below images shows various installation windows.

              

Step 4: Install Kotlin Eclipse Plugin [optional]

This step is not mandatory. If you love to write code in eclipse follow steps to add Kotlin Plugin.

Download Eclipse

Steps to install eclipse in Windows 10

                  

Finally, install Kotlin Plugin

          

 

0 Comments
Leave A Comment

Please login to post your valuable comments.

share