How to Download and Install Kotlin on Windows

2 minute read

download install kotlin windows

So you want to download and install Kotlin on Windows?

Then look no further!

In this guide, you’ll learn how to download the compiler…

…and how to configure it so you can use it from command line.

So let’s fire away:

What is Kotlin?

Kotlin is a programming language. It runs on the Java Virtual Machine (JVM) but also provides the ability to target JavaScript.

A key aspect of Kotlin is the interoperability with Java. You can write Kotlin and Java code in the same project and they’ll work hand in hand.

Kotlin originated at JetBrains and has been open source since 2012.

Step #1: Check Prerequisites

Kotlin needs a JDK to work. So let’s check if you have one configured on your system.

Click on the search button. Then type “cmd” (without quotes).

On Windows 7 click on the Windows button.

Click on the Command Prompt shortcut.

windows search cmd

Wait for the command prompt to open.

Type “javac -version” and press ENTER.

jdk version command

The above command prints the installed JDK version.

jdk installed version

For Kotlin you need JDK version 1.6 or higher.

If you do not have a Java Development Kit installed on your system. Check following post which details how to install a JDK on Windows 10.

Step #2: Download

Go to the Kotlin Latest Release page on GitHub.

Click on the kotlin-compiler-X.X.X.zip link under the Assets section.

At the time of writing the latest stable Kotlin release was version 1.2.61.

kotlin latest stable release

Wait for the download to complete.

Step #3: Install

Open the location of the downloaded installer.

kotlin downloaded compiler

Right-click the ZIP archive file. Select Extract All….

kotlin downloaded compiler extract all

Select an extract destination for the Kotlin files.

In this example, we extract in C:\Users\Downlinko\tools\kotlin.

kotlin extract destination

Click on Extract. This extracts all kotlin files under C:\Users\Downlinko\tools\kotlin\kotlinc.

From now on we refer to this location as [KOTLIN_INSTALL_DIR].

kotlin install dir

Step #4: Setup

We need to set up an environment variable that will point to our Kotlin installation.

Click on the search button. Then type “env”.

On Windows 7 click on the Windows button.

Click on the Edit environment variables for your account shortcut.

windows search env

Wait for the environment variables window to open.

Click on New….

windows account environment variables jdk new

Enter “KOTLIN_HOME” as variable name. Enter the [KOTLIN_INSTALL_DIR] as variable value.

In this tutorial the installation directory is: C:\Users\Downlinko\tools\kotlin\kotlinc.

Click OK.

kotlin home variable

Next, we need to configure the PATH environment variable so we can run Kotlin from a command prompt.

Select the PATH variable. Click on Edit….

kotlin edit path variable

Click on New and type “%KOTLIN_HOME%\bin” as shown below.

Click OK.

kotlin path variable

Click OK once more to close the environment variables window.

kotlin windows account environment variables

On Windows 7 you cannot add extra values for an existing Path variable. You need to append “;%KOTLIN_HOME%\bin” at the end of the variable value instead.

Step #5: Test

To test the setup click on the search button. Then type “cmd”.

Click on the Command Prompt shortcut.

windows search cmd

Wait for the command prompt to open.

Type “kotlinc -version” and press ENTER.

kotlin version command

The above command prints the installed Kotlin version.

kotlin version output

Congratulations, you have installed Kotlin on Windows 10!

Now get started and write your first lines of Kotlin code.

Be sure to leave a comment if you liked this post.

Thanks!

Leave a comment