Contains instructions on how to install Kotlin in an Ubuntu operating system. With a sample code on how to compile and execute a simple program.



  • Ubuntu 18 or higher
  • Java is installed


Install via SDKMAN

01. Open a terminal and install applications needed by SDKMAN

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems

$ sudo apt update

$ sudo apt install unzip

$ sudo apt install zip


02. and install SDKMAN, which will be used to install Kotlin.

$ cd ~

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


03. Exit from the terminal and open a new one. Test if SDKMAN is installed correctly. Help instructions should be shown.

$ sdk help


04. Install Kotlin

$ sdk install kotlin


05. Verify that Kotlin is installed. The following should output the version of Kotlin installed.

$ kotlin -version


If an error saying java command is not found, it means that Java is not installed.


Install via Snap

01. Install Kotlin

$ sudo snap install --classic kotlin


02. Verify that Kotlin is installed. The following should output the version of Kotlin installed.

$ kotlin -version


Running Kotlin

Run a Kotlin program that shows a message to the console/output.

01. Create a file named hello-geek.kt

$ cd

$ nano hello-geek.kt

Set the content as follows

fun main(args: Array<String>) {

println("Hello, Geek!")



02. Compile the application using Kotlin. This creates a JAR (Java Archive) file

$ kotlinc hello-geek.kt -include-runtime -d hello-geek.jar


03. Run the application using Java

$ java -jar hello-geek.jar



“Kotlin is a cross-platform, statically typed, general-purpose programming language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM version of its standard library depends on the Java Class Library,[2] but type inference allows its syntax to be more concise”

— Wikipedia.org


Kotlin is good language. If you are using the JVM and you want to use a different language aside from Java, this is a good option.


Previous Google I/O 2019 | Material Theming: Build Expressively with Material Components
Next Google I/O 2019 | Stadia Streaming Tech: A Deep Dive