In today’s guide we will walk you through the steps to install Kotlin Programming Language on Linux Mint | Ubuntu. Kotlin is an elegant, highly concise, fluent, and expressive statically typed multi-paradigm language that compiles down to both Java bytecode and JavaScript.

Kotlin ca be used to build front-end, server-side, and Android applications. Kotlin is designed to interoperate with Java and is fully supported on the Android operating system by Google. For sure Kotlin is a modern approach to object-oriented programming (OOP). If you have Java development experience mastering Kotlin language basics and progressing through actual applications building to running on the JVM and Android devices should take short time.

install kotlin

Install Kotlin Programming Language on Linux Mint | Ubuntu

There are multiple options available to you for installing Kotlin Programming Language on Linux Mint | Ubuntu. All the methods should work just fine without any tweaks and hacks.

The common methods of installing Kotlin Programming Language on Linux Mint | Ubuntu are:

  • Installation of Kotlin on Ubuntu | Linux Mint using SDKMAN
  • Installation of Kotlin on Ubuntu | Linux Mint using a Snap package
  • Building Kotlin from source

We will use the first two methods to install Kotlin Programming Language on Linux Mint | Ubuntu.

Method 1: Install Kotlin Programming Language on Linux Mint | Ubuntu using SDKMAN

SDKMAN is a command line tool that allows you to manage multiple versions of your Software Development Kits in parallel on most Unix based systems. Aside from the Command Line Interface(CLI) an API is available for installing, switching, removing and listing Candidates.

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

curl -s "https://get.sdkman.io" | bash

This script should work on Linux, macOS, WSL, Solaris, Cygwin, and on a FreeBSD system. Below is my command execution output:


                                -+syyyyyyys:
                            `/yho:`       -yd.
                         `/yh/`             +m.
                       .oho.                 hy                          .`
                     .sh/`                   :N`                `-/o`  `+dyyo:.
                   .yh:`                     `M-          `-/osysoym  :hs` `-+sys:      hhyssssssssy+
                 .sh:`                       `N:          ms/-``  yy.yh-      -hy.    `.N-````````+N.
               `od/`                         `N-       -/oM-      ddd+`     `sd:     hNNm        -N:
              :do`                           .M.       dMMM-     `ms.      /d+`     `NMMs       `do
            .yy-                             :N`    ```mMMM.      -      -hy.       /MMM:       yh
          `+d+`           `:/oo/`       `-/osyh/ossssssdNMM`           .sh:         yMMN`      /m.
         -dh-           :ymNMMMMy  `-/shmNm-`:N/-.``   `.sN            /N-         `NMMy      .m/
       `oNs`          -hysosmMMMMydmNmds+-.:ohm           :             sd`        :MMM/      yy
      .hN+           /d:    -MMMmhs/-.`   .MMMh   .ss+-                 `yy`       sMMN`     :N.
     :mN/           `N/     `o/-`         :MMMo   +MMMN-         .`      `ds       mMMh      do
    /NN/            `N+....--:/+oooosooo+:sMMM:   hMMMM:        `my       .m+     -MMM+     :N.
   /NMo              -+ooooo+/:-....`...:+hNMN.  `NMMMd`        .MM/       -m:    oMMN.     hs
  -NMd`                                    :mm   -MMMm- .s/     -MMm.       /m-   mMMd     -N.
 `mMM/                                      .-   /MMh. -dMo     -MMMy        od. .MMMs..---yh
 +MMM.                                           sNo`.sNMM+     :MMMM/        sh`+MMMNmNm+++-
 mMMM-                                           /--ohmMMM+     :MMMMm.       `hyymmmdddo
 MMMMh.                  ````                  `-+yy/`yMMM/     :MMMMMy       -sm:.``..-:-.`
 dMMMMmo-.``````..-:/osyhddddho.           `+shdh+.   hMMM:     :MmMMMM/   ./yy/` `:sys+/+sh/
 .dMMMMMMmdddddmmNMMMNNNNNMMMMMs           sNdo-      dMMM-  `-/yd/MMMMm-:sy+.   :hs-      /N`
  `/ymNNNNNNNmmdys+/::----/dMMm:          +m-         mMMM+ohmo/.` sMMMMdo-    .om:       `sh
     `.-----+/.`       `.-+hh/`         `od.          NMMNmds/     `mmy:`     +mMy      `:yy.
           /moyso+//+ossso:.           .yy`          `dy+:`         ..       :MMMN+---/oys:
         /+m:  `.-:::-`               /d+                                    +MMMMMMMNh:`
        +MN/                        -yh.                                     `+hddhy+.
       /MM+                       .sh:
      :NMo                      -sh/
     -NMs                    `/yy:
    .NMy                  `:sh+.
   `mMm`               ./yds-
  `dMMMmyo:-.````.-:oymNy:`
  +NMMMMMMMMMMMMMMMMms:`
    -+shmNMMMNmdy+:`


                                                                 Now attempting installation...


Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Download script archive...
######################################################################## 100.0%
Extract script archive...
Install scripts...
Set version to 5.9.1+575 ...
Attempt update of interactive bash profile on regular UNIX...
Added sdkman init snippet to /home/jkmutai/.bashrc
Attempt update of zsh profile...
Updated existing /home/jkmutai/.zshrc



All done!


Please open a new terminal, or run the following in the existing one:

    source "/home/jkmutai/.sdkman/bin/sdkman-init.sh"

Then issue the following command:

    sdk help

Enjoy!!!

You’ll need to source the shell environment to activate.

$ source ~/.sdkman/bin/sdkman-init.sh

The sdk command should be available for use in your shell environment.

$ sdk version
SDKMAN 5.9.1+575

The next step is to open your terminal and install Kotlin with sdk command:

sdk install kotlin

Be patient as the installation may take some minutes.

....
Downloading: kotlin 1.4.21

In progress...

####################################################################################################################################################################################################################### 100.0%####################################################################################################################################################################################################################### 100.0%

Installing: kotlin 1.4.21
Done installing!


Setting kotlin 1.4.21 as default.

Checking Kotlin version installed.

$ kotlin -version
Kotlin version 1.4.21-release-351 (JRE 11.0.7+10-post-Ubuntu-3ubuntu1)

After the installation you can start its interactive shell.

$ kotlin 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/home/jkmutai/.sdkman/candidates/kotlin/1.4.21/lib/kotlin-compiler.jar) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Welcome to Kotlin version 1.4.21 (JRE 11.0.7+10-post-Ubuntu-3ubuntu1)
Type :help for help, :quit for quit
>>> 

Method 2: Install Kotlin Programming Language on Linux Mint | Ubuntu from Snap

Kotlin can also be installed on Ubuntu | Linux Mint Linux from a Snap package. Snap is already installed on Ubuntu 16.04+ systems.

If you machine doesn’t have snapd install with the below commands:

sudo apt update
sudo apt install snapd

For Linux Mint 20 use our guide How To Install and Use Snap in Linux Mint 20

Once snap has been installed use the commands below to get Kotlin Programming Language on Linux Mint | Ubuntu from Snap:

sudo snap install --classic kotlin

Testing Kotlin with Hello World Program

Now that we’ve installed Kotlin on Linux Mint and Ubuntu system let’s create a simple application in Kotlin that displays “Hello, World!” message.

tee hello-world.kt <<EOF
fun main() {
    println("Hello, World!")
}
EOF

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

kotlinc hello-world.kt -include-runtime -d hello-world.jar

This generated .jar application which you can run with:

$ java -jar hello-world.jar
Hello, World!

There you go!. You’ve successfully install and tested Kotlin Programming Language on Ubuntu / Linux Mint. We also have an article on the top recommended Kotlin books.

Best Books To Learn Kotlin Programming

Best Grafana and Prometheus Monitoring Books

Install Julia Programming Language on Linux Mint | Ubuntu

LEAVE A REPLY

Please enter your comment!
Please enter your name here