Install Kotlin on Linux Mint 20 - Step by step guide ?

Kotlin is a programming language that can be used for general purposes and is also capable of working along with Java. It was developed by JetBrains. Kotlin can be used to build front-end, server-side, and Android applications. 

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Java queries.

In this context, we shall look into the procedure of installing Kotlin on a Linux Mint 20 system.

Steps to install Kotlin on Linux Mint 20

1. Perform System Update

It's important to make sure your system is up to date by running the following apt commands in the terminal:

$ sudo apt update

2. Install Kotlin Programming Language on the system

i. Install Kotlin using Snap.

Run the following commands to install Snap packages:

$ sudo rm /etc/apt/preferences.d/nosnap.pref
$ sudo apt update
$ sudo apt install snapd

To install Kotlin, simply use the following command:

$ sudo snap install kotlin --classic

ii. Install Kotlin using SDKMAN.

To install the SDKMAN tool run the following commands in your terminal:

$ curl -s "" | bash

Next, you’ll need to source the shell environment to activate:

$ source ~/.sdkman/bin/

Then, open your terminal and install Kotlin with sdk command:

$ sdk install kotlin

Check Kotlin version installed:

$ kotlin -version

How to test Kotlin with Hello World Program ?

Now we create a simple application in Kotlin that displays "Hello, Linux user!" message:

tee hello-linux-user.kt <<EOF
fun main() {
    println("Hello, Linux User!")

Kotlin programs need to be compiled using the Kotlin compiler before execution:

$ kotlinc hello-linux-user.kt -include-runtime -d hello-linux-user.jar

This generated .jar application which you can run with:

$ java -jar hello-linux-user.jar
Hello, Linux User!

How to uninstall Kotlin from Linux Mint 20 ?

To remove the Kotlin programming language from a Linux Mint 20 system, you need to execute the following command:

$ sudo snap remove kotlin

[Need help in fixing Software Installation issues ? We can help you. ]

This article covers the complete procedure to install Kotlin and get started with it on a Linux Mint 20 system. In fact, Kotlin is an elegant, highly concise, fluent, and expressive statically typed multi-paradigm language that compiles down to both Java bytecode and JavaScript.

Related Posts