Install Kotlin – Command line compiler in Ubuntu

Kotlin is an open-source, statically typed programming language. It supports both functional as well as object-oriented programming. Moreover, there are multiple ways to install Kotlin in Ubuntu. In addition to command line compiler, Kotlin code can also be compiled from IntelliJ IDEA and Eclipse. Also, Kotlin is interoperable with Java. In this article, we would focus on installation of command line compiler of Kotlin.

Even though, we can install Kotlin Compiler with ease. To launch the interactive shell (REPL) or running the compiler would require the presence of Java run-time on our Operating system. Since, Ubuntu already has one in its repository. We would install OpenJDK Java runtime if its not already installed. The package that we would install is openjdk-11-jre.

Install OpenJDK Java runtime

To install OpenJDK Java run-time, you need to have superuser privileges. Otherwise, contact your system administrator for assistance.

sudo apt install openjdk-11-jre

Install Kotlin – Command line compiler

To download the command line compiler, visit Github page of JetBrains/Kotlin.

At the time of writing the article, the latest stable version was 1.3.41.

When you will scroll down the page, there is list of files available to download. To install Kotlin compiler, we need to have file.

Move to the Downloads directory.

cd ~/Downloads/

Unzip it with the help of unzip command.


Furthermore, we will add the path variable to the .bashrc file to access the compiler directly without providing its complete path.

nano ~/.bashrc

We have used nano text editor, you can use one of your own choice. Afterwards, append the file with the following –

export PATH=~/Downloads/kotlinc/bin:$PATH

Running the REPL

REPL is an acronym for Read-Eval-Print-Loop; it is basically an interactive shell for the programming language. To run the REPL, we need to open the terminal and type the following –


Lastly, to quit from REPL,


In Conclusion, we have discussed Command-line Compiler installation for Kotlin programming language.