
If you are a developer or sysadmin running Ubuntu 26.04 LTS “Resolute Raccoon,” you already know how frustrating it is to search for a clear, no-nonsense guide to setting up a Kotlin development environment. Most tutorials out there are either outdated, tied to Ubuntu 20.04, or skip over the “why” completely and just throw commands at you. This guide covers how to install Kotlin on Ubuntu 26.04 using three battle-tested methods: Snap, SDKMAN!, and manual archive installation. By the time you finish reading, you will have a working Kotlin compiler, a verified Java runtime, and a compiled “Hello World” program running on your machine.
Ubuntu 26.04 LTS was released on April 23, 2026, under the codename “Resolute Raccoon,” and it ships with OpenJDK 25 as its default Java version — a meaningful upgrade from the OpenJDK 21 default used in Ubuntu 24.04 LTS. That matters for Kotlin developers because Kotlin 2.3.x (the current stable series as of May 2026) fully supports Java 25 bytecode targets, which means you get access to performance improvements like Compact Object Headers and measurable JVM runtime gains right out of the box.
Whether you are building an Android app, a server-side Ktor project, or just learning Kotlin as a second language after Java, this Linux server tutorial gives you every command, every explanation, and every troubleshooting fix in one place.
Prerequisites: What You Need Before You Start
Before running a single command, make sure your environment meets these requirements. Skipping this step is the number one reason installations fail midway.
System requirements:
- Ubuntu 26.04 LTS (Resolute Raccoon) installed and up to date
- A user account with
sudoprivileges - At least 2 GB RAM and 5 GB of free disk space
- An active internet connection (required for Snap and SDKMAN! methods)
- A terminal emulator (GNOME Terminal, Tilix, or SSH session for servers)
Software dependencies:
- Java Development Kit (JDK) — Kotlin compiles to JVM bytecode, so it requires a JDK at compile time and a JRE at runtime
curl,zip,unzip— needed for the SDKMAN! installation methodwget— needed for the manual archive method
If you are unsure whether you have sudo access, run sudo whoami. If it returns root, you are good to go.
Step 1: Update Your System and Install OpenJDK 25
The very first thing you should do on any Ubuntu server before installing new software is refresh the package index. This forces apt to fetch the latest metadata from all configured repositories.
sudo apt update && sudo apt upgrade -y
What this does: apt update downloads the latest package lists from Ubuntu’s repositories. apt upgrade -y applies all pending security and feature updates. Running both together ensures you are not installing Kotlin on top of a system with unpatched dependencies.
Why it matters: Ubuntu’s package cache can be days or weeks out of date on a fresh installation. Without refreshing it, you risk installing an outdated JDK package or hitting a 404 Not Found error from a stale mirror URL.
Install OpenJDK 25
Ubuntu 26.04 LTS ships OpenJDK 25 as its default Java version. Install it with:
sudo apt install default-jdk -y
This installs the full JDK (not just the JRE), which includes the javac compiler that Kotlin’s build tools need internally.
Expected output:
Reading package lists... Done
Building dependency tree... Done
The following additional packages will be installed:
openjdk-25-jdk openjdk-25-jre
...
Setting up openjdk-25-jdk (25+...) ...
Verify the Java Installation
java -version
javac -version
Expected output:
openjdk version "25" 2025-09-16
OpenJDK Runtime Environment (build 25+...)
OpenJDK 64-Bit Server VM (build 25+..., mixed mode, sharing)
javac 25
Why check both binaries: java runs JVM applications (the runtime). javac is the compiler toolchain. Kotlin’s internal build system calls javac APIs directly. If only java is installed (JRE only), the Kotlin compiler will throw a tools.jar not found error during compilation.
Step 2: Choose Your Installation Method
There are three ways to install Kotlin on Ubuntu 26.04 LTS. Each serves a different use case, and picking the wrong one for your workflow wastes time later.
| Method | Best For | Auto-Updates | Version Control |
|---|---|---|---|
| Snap | Beginners, quick setup | Yes | Limited |
| SDKMAN! | Developers, multi-project | Yes (manual trigger) | Full |
| Manual archive | CI/CD, air-gapped servers | No | Full |
If you are a developer managing multiple projects with different Kotlin version requirements, go straight to Step 4 (SDKMAN!). If you just want Kotlin running in under two minutes, Step 3 (Snap) is your path. For server automation or offline environments, use Step 5 (Manual).
Step 3: Install Kotlin via Snap (Fastest Method)
Snap is Canonical’s universal package manager built into every Ubuntu installation. It handles sandboxing, auto-updates, and dependency bundling automatically, making it the lowest-friction way to get Kotlin running on Ubuntu 26.04 LTS.
Verify snapd is Running
sudo systemctl status snapd
What to look for: The output should show Active: active (running). On a fresh Ubuntu 26.04 desktop or server install, snapd runs by default.
Why this step exists: On minimal Ubuntu Server installations or containers, snapd can be disabled or not installed at all. If snap install hangs with no output, a stopped snapd daemon is almost always the cause.
If snapd is not running:
sudo systemctl enable --now snapd
Install Kotlin
sudo snap install --classic kotlin
What --classic does: It removes the Snap sandbox restrictions and gives Kotlin access to the full filesystem. Without this flag, the Kotlin compiler cannot read your source files from arbitrary directories or write compiled .class files to your project folder. The installation will succeed but the compiler will silently fail on the first build.
Expected output:
kotlin 2.3.20 from JetBrains s.r.o. (jetbrains) installed
Verify the Snap Installation
kotlin -version
kotlinc -version
Expected output:
Kotlin version 2.3.20-release-407 (JRE 25+...)
info: kotlinc-jvm 2.3.20 (JRE 25+...)
If you see kotlin: command not found, run export PATH=$PATH:/snap/bin and try again. This happens when the current shell session has not loaded the updated PATH that Snap writes to /etc/environment.
Step 4: Install Kotlin on Ubuntu 26.04 via SDKMAN! (Recommended for Developers)
SDKMAN! (Software Development Kit Manager) is the method officially recommended by the Kotlin documentation. It works like nvm for Node.js — you can install multiple Kotlin versions side by side and switch between them with a single command. This is critical when you maintain projects that target different Kotlin API versions or Gradle compatibility windows.
Install SDKMAN! Dependencies
sudo apt install curl zip unzip -y
Why these three packages: The SDKMAN! bootstrap script is fetched via curl. It downloads all SDK archives as .zip files and needs unzip to extract them. Without these installed, the SDKMAN! installer will exit with a cryptic command not found error.
Download and Run the SDKMAN! Installer
curl -s https://get.sdkman.io | bash
What this script does: It creates the ~/.sdkman/ directory, downloads the SDKMAN! binary, and appends initialization code to your ~/.bashrc and ~/.zshrc files. It auto-detects your default shell and configures both.
Why pipe directly to bash: This is the official SDKMAN! installation method. The script handles every OS-specific path and configuration difference automatically. Running the script manually and then sourcing it separately introduces ordering errors.
Expected output (final lines):
All done!
Please open a new terminal, or run the following in the existing one:
source "/home/youruser/.sdkman/bin/sdkman-init.sh"
Then issue the following command:
sdk help
Initialize SDKMAN! in the Current Shell
source "$HOME/.sdkman/bin/sdkman-init.sh"
Why source instead of opening a new terminal: The sdk command is a shell function, not a binary stored in /usr/bin/. It only exists within a shell session after the init script has been loaded. If you skip this step and try to run sdk install kotlin, the shell returns sdk: command not found even though SDKMAN! installed correctly.
Install the Latest Stable Kotlin
sdk install kotlin
What happens here: SDKMAN! queries its candidate registry, downloads the latest stable Kotlin compiler archive, extracts it to ~/.sdkman/candidates/kotlin/, and creates a symlink at ~/.sdkman/candidates/kotlin/current/. It also updates your PATH automatically.
Expected output:
Downloading: kotlin 2.3.20
In progress...
########################################################## 100.0%
Installing: kotlin 2.3.20
Done installing!
Setting kotlin 2.3.20 as default.
Configure Kotlin on Ubuntu 26.04 for Multi-Version Workflows
This is where SDKMAN! pulls ahead of every other method. If you need to work with a specific Kotlin version for an older project:
sdk list kotlin # See all available versions
sdk install kotlin 1.9.25 # Install a specific version
sdk use kotlin 1.9.25 # Switch for the current session only
sdk default kotlin 2.3.20 # Set permanent default
Why version pinning matters: Kotlin 2.x introduced changes to the K2 compiler that can break builds in older Gradle projects. Being able to switch compilers without uninstalling anything is a production-grade capability.
Verify SDKMAN! Kotlin Installation
sdk current kotlin
kotlinc -version
Expected output:
Using kotlin version 2.3.20
info: kotlinc-jvm 2.3.20 (JRE 25+...)
Step 5: Manual Installation via GitHub Release Archive
Use this method when you are working on a headless server without internet access, setting up a CI/CD pipeline with a locked toolchain, or need a specific Kotlin compiler build not yet published to SDKMAN!.
Download the Kotlin Compiler ZIP
wget https://github.com/JetBrains/kotlin/releases/download/v2.3.20/kotlin-compiler-2.3.20.zip
Why wget on a server: Headless Ubuntu servers have no GUI browser. wget downloads directly to your current working directory via the command line. It also supports resume (-c flag) if the download drops on a slow connection.
Extract to /opt/
sudo unzip kotlin-compiler-2.3.20.zip -d /opt/
Why /opt/ specifically: The Linux Filesystem Hierarchy Standard defines /opt/ as the correct location for third-party software not managed by the system package manager. Placing Kotlin here makes it accessible to all users on the system, unlike ~/Downloads/, which is user-specific and excluded from system-level scripts.
Add Kotlin to Your PATH
echo 'export PATH="/opt/kotlinc/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
What echo >> ~/.bashrc does: It appends the export PATH line to your Bash configuration file, making the Kotlin binaries discoverable every time a new shell session opens.
Why source ~/.bashrc immediately after: Without sourcing, the PATH change takes effect only in new terminal sessions. source reloads the configuration file in the current session so you can use kotlinc right away without logging out.
Verify the Manual Installation
kotlinc -version
Expected output:
info: kotlinc-jvm 2.3.20 (JRE 25+...)
Step 6: Write, Compile, and Run Your First Kotlin Program
Regardless of which installation method you used, this step confirms that your entire toolchain (JDK + Kotlin compiler + JVM runtime) works together correctly.
Create a Kotlin Source File
nano HelloUbuntu.kt
Paste this code:
fun main() {
println("Hello from Kotlin on Ubuntu 26.04 LTS!")
}
Save with Ctrl+O, then exit with Ctrl+X.
Why .kt extension: The kotlinc compiler identifies Kotlin source files by this extension. Using .txt or any other extension causes the compiler to silently skip the file with no error message.
Compile the Program
kotlinc HelloUbuntu.kt -include-runtime -d HelloUbuntu.jar
Why -include-runtime: Without this flag, the output JAR does not bundle the Kotlin standard library. The program will run fine on your machine (where the library is installed globally), but will throw ClassNotFoundException: kotlin.jvm.internal.Intrinsics on any system without Kotlin installed. Adding -include-runtime makes the JAR portable and production-ready.
Why -d HelloUbuntu.jar: The -d flag sets the output destination. A .jar file is a self-contained Java archive that the JVM can execute on any OS, making it the standard deployment artifact for JVM-based applications.
Run the Program
java -jar HelloUbuntu.jar
Expected output:
Hello from Kotlin on Ubuntu 26.04 LTS!
Why java -jar instead of kotlin HelloUbuntu.jar: Using java -jar tests real portability. It confirms the JAR runs correctly in a standard JVM environment without needing the Kotlin runtime on the PATH, which is exactly how your program will run in production deployments.
Troubleshooting: Common Errors and Fixes
Even on a clean Ubuntu 26.04 setup, a few issues show up regularly. Here are the five most common ones and how to fix them fast.
Error 1: kotlinc: command not found after Snap install
- Cause: Snap modifies
/etc/environment, which only loads at login. Your current shell session has the old PATH. - Fix:
export PATH=$PATH:/snap/bin
Then add this line to ~/.bashrc to make it permanent.
Error 2: sdk: command not found after SDKMAN! install
- Cause: The SDKMAN! init script was not sourced in the current session.
- Fix:
source "$HOME/.sdkman/bin/sdkman-init.sh"
Error 3: error: unable to find tools.jar
- Cause: You installed only the JRE (
default-jre) instead of the full JDK (default-jdk). Thetools.jarfile lives in the JDK and contains compiler APIs thatkotlincneeds. - Fix:
sudo apt install default-jdk -y
javac -version
Error 4: ClassNotFoundException when running the compiled JAR
- Cause: The JAR was compiled without
-include-runtime, so it is missing the Kotlin standard library. - Fix: Recompile with the correct flag:
kotlinc HelloUbuntu.kt -include-runtime -d HelloUbuntu.jar
Error 5: snap install fails with “classic confinement not available”
- Cause: This happens on some Ubuntu Server minimal images or LXD containers where classic confinement is disabled.
- Fix: Use the SDKMAN! or manual method instead. Classic Snap confinement requires a full Ubuntu base with
snapdfully configured, which LXD containers sometimes restrict.
Congratulations! You have successfully installed Kotlin. Thanks for using this tutorial for installing the Kotlin programming language on the Ubuntu 26.04 LTS (Resolute Raccoon) system. For additional help or useful information, we recommend you check the official Kotlin website.