[Setup] Kotlin Development Environment
This page walks you through setting up an environment for writing and running Kotlin programs.
Kotlin is a standalone language that runs on the JVM (Java Virtual Machine). Once compiled, it becomes the same bytecode as Java, so the JVM is required, but the syntax and features are distinct from Java. For that reason, setting up Kotlin starts with installing the JDK.
Installing the JDK
The JDK (Java Development Kit) is a toolset for running the Java language. It bundles the compiler (javac), the standard library, the JRE (Java Runtime Environment), and the JVM (Java Virtual Machine) together.
The JVM is used not only by Java but also by other JVM-based languages such as Kotlin, Scala, and Groovy. That is why installing the JDK is the standard first step for setting up Kotlin as well.
As a side note, up through Java 8 the JDK (for development) and the JRE (for runtime only) were distributed separately, but starting with Java 9 the standalone JRE distribution was discontinued. So today, installing one JDK gives you everything you need.
See the table below for a quick overview.
| OS | Installation Method |
|---|---|
| macOS | Run brew install openjdk with Homebrew. Homebrew is a package manager for macOS. If it is not installed, follow the instructions on the official site (https://brew.sh/). Alternatively, download the installer from Adoptium. |
| Windows | Download and run the installer from Adoptium (formerly AdoptOpenJDK). Restart your PC after the installation completes. |
macOS
Here is how to install with Homebrew. After Homebrew is ready, run the following command.
brew install openjdk
When installing with Homebrew on macOS, always run the command below afterward. Homebrew's openjdk is not automatically added to PATH, so this step is required.
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
Next, set up your PATH. Run whichever command matches your shell (macOS defaults to zsh). If you are not sure which shell you are using, run echo $SHELL to check.
For zsh:
echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
For bash:
echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
After installation, verify by running the following in the terminal.
javac --version javac 21.0.3 java --version openjdk 21.0.3
If both commands display version numbers, the JDK installation is complete.
Windows
Download the installer from Adoptium (formerly AdoptOpenJDK).

Double-click the installer. When the screen below appears, click Next.

Check "I accept the terms in the License Agreement" and click Next.

You can leave the following screen at its default selection. If you want to install for a specific user only, check "Install just for you xxx".

The next screen can also be left as-is. Click Next.

Click "Install".

On the following screen, click "Yes".

After the installation progress screen, wait a moment until the following screen appears. Click Finish as-is.

After installation, on Windows verify by running the following in PowerShell or Command Prompt.
javac --version javac 21.0.3 java --version openjdk 21.0.3
If both commands display version numbers, the JDK installation is complete.
Installing the Kotlin Compiler
macOS
You can install it with Homebrew.
brew install kotlin
After installation, verify with the following command.
kotlinc -version info: kotlinc-jvm 2.3.20 (JRE 25.0.2)
If the version information is displayed, the Kotlin compiler installation is complete.
Windows
Open the Kotlin GitHub releases page and download the latest kotlin-compiler-x.x.x.zip. It is a bit hard to spot — the link is inside the "Assets" dropdown.

Right-click the downloaded ZIP file, choose "Extract All", and extract it to a folder of your choice. Below is an example of extracting into the Downloads folder. You can see a folder called kotlinc inside the extracted folder.

One note: unless you have a specific reason, copy that kotlinc folder directly under the C: drive. Since you need to register the folder location in the PATH environment variable, keeping the path shallow like C:\kotlinc makes it easier to manage. Putting ZIP-extracted tools directly under the C: drive is a common pattern worldwide — there are no spaces in the path (paths like "Program Files" can sometimes cause trouble) and the path is short and easy to handle.

Next, open the bin folder inside kotlinc. You will copy the address bar contents into PATH shortly, so leave File Explorer open at this folder for now.

Next, add the bin folder inside the extracted folder to the PATH environment variable. Open Settings → System → About → Advanced system settings → Environment Variables.




On the following screen, double-click "Path", or select "Path" and click "Edit".

On the next screen, click "New" and add the path to the bin folder you had open in File Explorer (for example: C:\kotlin\kotlinc\bin). Copying from the File Explorer address bar is the easiest way.

In the end, you should see the value added as shown below.

After installation, verify with the following command in PowerShell or Command Prompt.
kotlinc -version info: kotlinc-jvm 2.3.20 (JRE 25.0.2+10-LTS)
If the version information is displayed, the Kotlin compiler installation is complete.
Installing SDKMAN
If you want to switch Kotlin versions per project, SDKMAN is convenient. Similar to nvm for Node.js, it lets you install and switch between multiple versions.
macOS
Run the following three commands in order.
curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" sdk install kotlin
Line 1 downloads and runs the SDKMAN installer script (extracted under $HOME/.sdkman/). Line 2 loads SDKMAN into the current terminal (new terminals load it automatically, so this is only needed the first time). Line 3 installs the latest stable version of Kotlin via SDKMAN.
After line 3, installation is complete when you see something like "Done installing! Kotlin x.x.x".
If you want to install and switch to a specific version, first check the list of available versions with sdk list kotlin.
sdk list kotlin
The version list from sdk list kotlin is shown with paging (internally it runs the less command). Press the space bar for the next page and q to close the list (the sdk list kotlin command).
After checking, install any version from the list.
sdk install kotlin 1.9.24
If a default version is already set, you will be asked something like "Do you want kotlin 1.9.24 to be set as default? (Y/n):". Enter Y to change the default, or n to keep it as-is.
To switch to an installed version, use sdk use or sdk default.
sdk use kotlin 1.9.24
sdk use is a temporary switch that only lasts for the current terminal session. Close the terminal and the original version comes back. If you want to keep using the same version going forward, run sdk default.
sdk default kotlin 1.9.24
After switching, verify the version change with the following command.
kotlinc -version
Older versions of Kotlin may not work with newer JDKs. For example, trying to use JDK 25 with Kotlin 1.9.24 results in an error like this.
kotlinc -version WARNING: A restricted method in java.lang.System has been called WARNING: java.lang.System::loadLibrary has been called by org.fusesource.hawtjni.runtime.Library in an unnamed module WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module WARNING: Restricted methods will be blocked in a future release unless native access is enabled info: kotlinc-jvm 1.9.24 (JRE 25.0.2) WARNING: A terminally deprecated method in sun.misc.Unsafe has been called WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.intellij.util.containers.ConcurrentLongObjectHashMap WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release exception: java.lang.IllegalArgumentException: 25.0.2 at com.intellij.util.lang.JavaVersion.parse(JavaVersion.java:305) at com.intellij.util.lang.JavaVersion.current(JavaVersion.java:174) at org.jetbrains.kotlin.cli.jvm.modules.JavaVersionUtilsKt.isAtLeastJava9(javaVersionUtils.kt:11) (stack trace omitted)
The core of the error is java.lang.IllegalArgumentException: 25.0.2, which means the JavaVersion.parse in the Kotlin 1.9 line cannot recognize the JDK 25 version string. The WARNING lines at the top are also signs that Kotlin 1.9 cannot fully handle the restrictions introduced in JDK 21 and later (the deprecation of "restricted methods" and sun.misc.Unsafe).
In such cases, it is convenient to manage the JDK version with SDKMAN as well.
Unfortunately, the official Kotlin documentation does not provide a compatibility matrix summarizing the JDK support range for each Kotlin version. You have to trace the "What's new" or "Compatibility Guide" for each version individually — there is no single reference provided that lets you see at a glance which JDK to choose.
A practical workaround is to install an "LTS (Long-Term Support) JDK" whose release date is close to that of the Kotlin version you are using. Kotlin does not always catch up immediately when a new JDK is released, so older LTS JDKs tend to have broader compatibility. As of April 2026, JDK 17 (released 2021) and JDK 21 (released 2023) are the main LTS versions. For example, JDK 21 is a natural choice for Kotlin 1.9 line (released 2023).
Use the steps below to install and switch the JDK via SDKMAN. First, check the list of available JDKs (displayed through less, same as sdk list kotlin).
sdk list java
Pick any version from the list, install it, and switch to it. The example below installs Adoptium (Temurin) JDK 21.
sdk install java 21.0.3-tem sdk use java 21.0.3-tem
sdk use is a temporary switch. If you want to use the same JDK going forward, run sdk default java 21.0.3-tem.
If you see an error like "SDKMAN requires Bash 4 or higher, but you are running Bash 3.2", the default Bash version on macOS is too old. Upgrade Bash with the following command.
brew install bash
After upgrading, restart your terminal before running the SDKMAN installation command again.
Windows (via WSL)
To use SDKMAN on Windows, install WSL (Windows Subsystem for Linux) first, then run the SDKMAN installation commands in the WSL terminal. Below is how to install WSL.
Right-click PowerShell and open it as Administrator. When prompted for administrator privileges, click "Yes".

Run the following command.
wsl --install

The download of WSL and Ubuntu begins. Wait until it completes.
wsl --install Downloading: Windows Subsystem for Linux 2.6.3 Installing: Windows Subsystem for Linux 2.6.3 Windows Subsystem for Linux 2.6.3 has been installed. The operation completed successfully. Downloading: Ubuntu Installing: Ubuntu Distribution successfully installed. It can be launched via 'wsl.exe -d Ubuntu' Launching Ubuntu... Provisioning the new WSL instance Ubuntu This might take a while... Create a default Unix user account:

Once the download and installation complete, you may be prompted to restart. If so, restart your computer.
After restarting, Ubuntu setup begins. First, enter a username. The username root cannot be used (it is already reserved by the system). Enter any other name you like.
Create a default Unix user account: root fatal: The user 'root' already exists. Failed to create user 'root'. Please choose a different name. Create a default Unix user account: test

Note that names starting with an underscore such as _user also cannot be used by default (due to Ubuntu's NAME_REGEX restriction). If you really want to use a name that violates NAME_REGEX, you first need to complete setup with a normal name and then work inside Ubuntu via WSL. So for now, create a temporary user here and keep the setup going — details are covered later.
Next, enter a password. Nothing appears on the screen as you type, but the input is being registered normally.
New password:

Enter the same password again to confirm.
Retype new password:

When the following screen appears, WSL setup is complete. You can now run the SDKMAN installation commands.
passwd: password updated successfully To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. test@hostname:/mnt/c/WINDOWS/system32$

Typing wsl in PowerShell or Command Prompt launches the WSL terminal (Ubuntu).
wsl
After running wsl, if you see a prompt like "username@HostComputerName:/mnt/c/Windows/system32$", you are good. The WSL terminal (Ubuntu) has launched without issue.

You can also launch it by searching for "Ubuntu" in the Start Menu. Launching it opens PowerShell.

If you see "There are no distributions installed for the Windows Subsystem for Linux.", Ubuntu is not installed. Install Ubuntu with the following command.
wsl --install -d Ubuntu
After installation completes, restart your PC and run wsl again. If Ubuntu launches successfully, the installation is complete.
By the way, the WSL terminal has a different copy and paste behavior than usual. On the terminal, right-clicking while text is selected copies it to the clipboard, and right-clicking with no text selected pastes from it. If you want to copy from outside the terminal, first copy to the clipboard with the usual Ctrl+C and then right-click on the terminal with no text selected. This is handy when entering long commands.
Kotlin inside WSL is managed by SDKMAN, so it is separately managed from the Kotlin you installed manually on Windows earlier (for example C:\kotlinc). Use the Kotlin on the Windows side through PowerShell or Command Prompt, and the Kotlin on the WSL side through the WSL terminal — each is independent.
Now for how to switch versions. SDKMAN installation requires unzip and zip. Ubuntu on WSL does not include them by default, so after launching WSL, install them with the following commands.
wsl
The command looks like this:
sudo apt install unzip zip -y
Run the following commands in order in the WSL terminal.
curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" sdk install kotlin
Installation is complete when you see something like "Done installing!".
If you want to install and switch to a specific version, first check the list of available versions with sdk list kotlin.
sdk list kotlin
The version list from sdk list kotlin is shown with paging (internally it runs the less command). Press the space bar for the next page and q to close the list (the sdk list kotlin command).
After checking, install any version from the list.
sdk install kotlin 1.9.24
If a default version is already set, you will be asked something like "Do you want kotlin 1.9.24 to be set as default? (Y/n):". Enter Y to change the default, or n to keep it as-is.
To switch to an installed version, use sdk use or sdk default.
sdk use kotlin 1.9.24
sdk use is a temporary switch that only lasts for the current terminal session. Close the terminal and the original version comes back. If you want to keep using the same version going forward, run sdk default.
sdk default kotlin 1.9.24
After switching, verify the version change with the following command.
kotlinc -version
Older versions of Kotlin may not work with newer JDKs. For example, trying to use JDK 25 with Kotlin 1.9.24 results in an error like this.
kotlinc -version WARNING: A restricted method in java.lang.System has been called WARNING: java.lang.System::loadLibrary has been called by org.fusesource.hawtjni.runtime.Library in an unnamed module WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module WARNING: Restricted methods will be blocked in a future release unless native access is enabled info: kotlinc-jvm 1.9.24 (JRE 25.0.2) WARNING: A terminally deprecated method in sun.misc.Unsafe has been called WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.intellij.util.containers.ConcurrentLongObjectHashMap WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release exception: java.lang.IllegalArgumentException: 25.0.2 at com.intellij.util.lang.JavaVersion.parse(JavaVersion.java:305) at com.intellij.util.lang.JavaVersion.current(JavaVersion.java:174) at org.jetbrains.kotlin.cli.jvm.modules.JavaVersionUtilsKt.isAtLeastJava9(javaVersionUtils.kt:11) (stack trace omitted)
The core of the error is java.lang.IllegalArgumentException: 25.0.2, which means the JavaVersion.parse in the Kotlin 1.9 line cannot recognize the JDK 25 version string. The WARNING lines at the top are also signs that Kotlin 1.9 cannot fully handle the restrictions introduced in JDK 21 and later (the deprecation of "restricted methods" and sun.misc.Unsafe).
In such cases, it is convenient to manage the JDK version with SDKMAN as well.
Unfortunately, the official Kotlin documentation does not provide a compatibility matrix summarizing the JDK support range for each Kotlin version. You have to trace the "What's new" or "Compatibility Guide" for each version individually — there is no single reference provided that lets you see at a glance which JDK to choose.
A practical workaround is to install an "LTS (Long-Term Support) JDK" whose release date is close to that of the Kotlin version you are using. Kotlin does not always catch up immediately when a new JDK is released, so older LTS JDKs tend to have broader compatibility. As of April 2026, JDK 17 (released 2021) and JDK 21 (released 2023) are the main LTS versions. For example, JDK 21 is a natural choice for Kotlin 1.9 line (released 2023).
Use the steps below to install and switch the JDK via SDKMAN. First, check the list of available JDKs (displayed through less, same as sdk list kotlin).
sdk list java
Pick any version from the list, install it, and switch to it. The example below installs Adoptium (Temurin) JDK 21.
sdk install java 21.0.3-tem sdk use java 21.0.3-tem
sdk use is a temporary switch. If you want to use the same JDK going forward, run sdk default java 21.0.3-tem.
After installation, verify with the following command.
kotlinc -version kotlinc-jvm 2.0.0 (JRE 21.0.3)
If the version is displayed, the installation is complete.
If you see "java: command not found", the Kotlin you installed on the Windows side (for example C:\kotlinc\bin) might be getting picked up first inside WSL. Check which kotlinc is being used with the command below.
which kotlinc
If a path like /mnt/c/... is shown, the Windows-side kotlinc is being used. To use the SDKMAN kotlinc, re-run the SDKMAN initialization as follows.
source "$HOME/.sdkman/bin/sdkman-init.sh" which kotlinc
If a path like /home/username/.sdkman/... is shown, the SDKMAN kotlinc is being used correctly.
Using a username that violates the NAME_REGEX restriction
This explains how to create a user with a name that violates Ubuntu's NAME_REGEX restriction (such as _user). You can skip this section if you do not need it. First, launch Ubuntu by running the wsl command.
wsl
Once launched, run the following command.
sudo adduser --allow-bad-names _user
You will be asked for "New password" and so on. Set the password the same way as before. After setting the password, you will be asked for profile information (Full Name, Room Number, etc.) — you can press Enter to skip all of them. Finally, you will see "Is the information correct? [Y/n]"; enter Y. When you see something like "info: Adding user '_user' to group 'users'", the user creation is complete.
sudo adduser --allow-bad-names _user
info: Allowing use of questionable username.
info: Adding user '_user' ...
info: Selecting UID/GID from range 1000 to 59999 ...
info: Adding new group '_user' (1001) ...
info: Adding new user '_user' (1001) with group '_user (1001)' ...
info: Creating home directory '/home/_user' ...
info: Copying files from '/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for _user
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
info: Adding new user '_user' to supplemental / extra groups 'users' ...
info: Adding user '_user' to group 'users' ...
Next, grant sudo privileges to the created user. Granting sudo privileges is not strictly required, but without it you will not be able to run commands that need administrator privileges such as userdel, so granting sudo is the safer choice.
sudo usermod -aG sudo _user
If you want to delete the temporary user created during setup, launch WSL as the newly created user and run the userdel command with sudo. You will be asked for a password — enter the current user's password. Adding the -r option to userdel deletes the home directory as well.
wsl -u _user
The command looks like this:
sudo userdel -r test [sudo] password for _user: userdel: test mail spool (/var/mail/test) not found
The warning "userdel: test mail spool ... not found" may be displayed, but it simply means the mail directory does not exist and is not a problem. The user has been deleted successfully.
After deletion, since the default user no longer exists, running the wsl command logs you in as the root user. To change the default user to the newly created one, run the following in PowerShell or Command Prompt.
ubuntu config --default-user _user
After the setting, run wsl and if you log in as the created user, the configuration is complete.
Compiling and Running
1. Create the source file
Use a text editor to create a file named hello.kt with the following content.
hello.kt
fun main() {
println("Hello, Kiryu Kazuma!")
println("I've been waitin' for ya... Kiryu-chaaan!!")
}
2. Compile
kotlinc hello.kt -include-runtime -d hello.jar
-include-runtime bundles the Kotlin runtime into the JAR. This produces a JAR file that can be run with Java alone. When compilation succeeds, a hello.jar file is generated (nothing is shown on success).
3. Run
java -jar hello.jar Hello, Kiryu Kazuma! I've been waitin' for ya... Kiryu-chaaan!!
If Hello, Kiryu Kazuma! and I've been waitin' for ya... Kiryu-chaaan!! are displayed, you're all set.
Windows (PowerShell) example
Below is an example of saving hello.kt in the Downloads folder.
cd is the command to change the current directory (the working folder). ls lists files in the current directory.
cd .\Downloads\
ls
Directory: C:\Users\_root\Downloads
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2026/04/01 21:15 117 hello.kt
The command looks like this:
kotlinc hello.kt -include-runtime -d hello.jar java -jar hello.jar Hello, Kiryu Kazuma! I've been waitin' for ya... Kiryu-chaaan!!

When non-ASCII text is mojibake in Windows PowerShell
On Windows PowerShell, output that contains non-ASCII characters (such as Japanese or other multi-byte scripts) is sometimes rendered as ????? or a sequence of unexpected symbols. This happens because the application emits UTF-8 bytes while the PowerShell console interprets them as a different code page (such as 437 for OEM US, or 932 for Shift-JIS). This issue is especially common when Windows is set to the English display language, and the same symptom appears when running Kotlin/Java output with java -jar hello.jar.
First, check the current console encoding.
[Console]::OutputEncoding chcp
[Console]::OutputEncoding returns the encoding that PowerShell uses when interpreting program output, and chcp returns the code page of the Windows console itself. If these show CodePage 437 or CodePage 932 instead of UTF-8 (65001), the mismatch is likely the cause.
To fix it for the current session only, run the following two lines in PowerShell.
$env:JAVA_TOOL_OPTIONS = "-Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8" [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()
The first line forces Java to write standard output and standard error as UTF-8. JAVA_TOOL_OPTIONS is an environment variable that Java reads automatically at startup, and when set, Java prints a message like Picked up JAVA_TOOL_OPTIONS: ... at launch. The second line tells PowerShell to interpret the received bytes as UTF-8. The key point is that both the sending side (Java) and the receiving side (PowerShell) are aligned on UTF-8.
After these, running java -jar hello.jar again should display the non-ASCII text correctly. The settings are lost when PowerShell is closed, so to make them persistent, add them to your PowerShell startup profile.
if (!(Test-Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force }
Add-Content $PROFILE '$env:JAVA_TOOL_OPTIONS = "-Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8"'
Add-Content $PROFILE '[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()'
$PROFILE is a built-in variable that holds the path of the script file PowerShell runs automatically at startup. The first line creates the file if it does not yet exist, and the second and third lines append the encoding settings. Reopening PowerShell applies the settings automatically from then on.
Note: You can also switch the code page itself to UTF-8 with chcp 65001, but this can affect compatibility with older commands. Aligning only the PowerShell output side and the Java output side on UTF-8 is the safer choice.
For how to write the file and add comments, see How to create and run .kt files.
Try in Your Browser (Kotlin Playground)
If you want to try Kotlin without setting up an environment, Kotlin Playground is convenient. You can type code in your browser and immediately see the execution result.
In the early stages of learning, experimenting with the syntax in Playground and then setting up a local environment when you move to more serious development tends to be a smooth path.
IDE (Integrated Development Environment — a single tool combining code editing, execution, and debugging) Development
| Tool | Description |
|---|---|
| IntelliJ IDEA | An IDE from JetBrains, the creators of Kotlin. It offers the most comfortable Kotlin development experience. The Community edition is free. |
| Android Studio | An IDE for Android app development. Based on IntelliJ IDEA with native Kotlin support. |
| VSCode | A lightweight editor. Installing the Kotlin extension adds syntax highlighting and code completion. Its formal name is "Visual Studio Code". |
When the command is not found
If your terminal shows kotlinc: command not found, the PATH may not be set. Follow the steps below to check and configure it.
1. Find the command location
Check where the command is located.
which kotlinc which kotlin
If not found, check common installation locations.
ls /opt/homebrew/bin/kotlinc ls ~/.sdkman/candidates/kotlin/current/bin/kotlinc
2. Check which shell you are using
echo $SHELL
If /bin/zsh is shown, edit ~/.zshrc. If /bin/bash is shown, edit ~/.bashrc.
3. Add to PATH
Once you know the command location, add the PATH to your shell's configuration file.
If installed with Homebrew (macOS zsh):
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
If installed with SDKMAN (macOS zsh):
echo 'export PATH="$HOME/.sdkman/candidates/kotlin/current/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
For Linux (bash):
echo 'export PATH="$HOME/.sdkman/candidates/kotlin/current/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
If you are using SDKMAN
If Kotlin installed via SDKMAN is not found, the shell initialization may be missing. Check that the following is in your shell configuration file.
SDKMAN initialization script:
export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
Also check the JDK PATH
Since Kotlin runs on the JVM, the java command also needs to be usable. If java -version returns an error, configure the JDK PATH as well.
On Windows, go to "Advanced System Settings" → "Environment Variables" → "Path" and add paths for both Kotlin and the JDK.
Uninstalling Kotlin
If installed via Homebrew:
brew uninstall kotlin
If installed via SDKMAN:
sdk uninstall kotlin
Windows (Uninstalling the JDK)
Here is how to uninstall Adoptium (Temurin) JDK on Windows.
1. Open Settings → Apps → Installed apps and type "Adoptium" in the search box. The JDKs installed from Adoptium will appear in the list. Click the "⋯" on the right end of the JDK you want to uninstall.

2. A dropdown menu appears. Click "Uninstall".

3. A confirmation dialog saying "This app and its related info will be uninstalled." appears. Click "Uninstall" to start the uninstallation.

If multiple versions are installed, repeat the same steps to remove the other versions.
Windows (Uninstalling the Kotlin compiler)
The Kotlin compiler is installed by extracting a ZIP file rather than via a GUI installer, so you need to manually delete the folder and remove the PATH environment variable entry.
1. In File Explorer, delete the folder where the Kotlin compiler was extracted (for example, C:\kotlinc).
2. Remove the corresponding path from the PATH environment variable. Type "environment variables" in the Start Menu search box, open "Edit the system environment variables", click the "Environment Variables" button, select "Path" under "System variables", click "Edit", select the Kotlin path, and click "Delete".
If you find any errors or copyright issues, please contact us.