Kotlin Environment setup for Command Line (original) (raw)
Last Updated : 04 May, 2025
To set up a Kotlin environment for the command line, you need to do the following steps:
- **Install the Java Development Kit (JDK): Kotlin runs on the Java virtual machine, so you need to have the JDK installed. You can download the latest version from the official Oracle website.
- **Download the Kotlin compiler: You can download the latest version of the Kotlin compiler from the official Kotlin website.
- **Set the environment variable: Add the location of the Kotlin compiler to the PATH environment variable. This will allow you to run Kotlin commands from anywhere in the command line.
- **Verify the installation: Open the command line and run the following command to verify that Kotlin has been installed correctly:
In this article, we will see how to set up the environment for Kotlin on the command line compiler.
**Prerequisite to install Kotlin:
Kotlin runs on the Java Virtual Machine, so it is necessary to install JDK and set the path in the local system environment variable. To install the JDK and JRE in your system and set the path in the environment variable, please refer this article - Setting up the environment in Java.
**Download the Kotlin compiler:
You can download the latest version of the standalone compiler of Kotlin from Github Releases. Now the latest version is **2.1.20. Go to the ultimate bottom of the website, then you will see **Assets, in that, download kotlin-compiler-2.1.20.zip.
**Set up the Kotlin compiler for the command line:
- First of all, extract the downloaded file to any location where you have write access.
- Copy the path up to the bin directory of kotlinc.
- Now open my computer properties -> Advanced System Settings and then click on Environment Variables.
- Click on the path in system variables, then click on the **edit button.
- Click on "New", now paste the copied path of bin directory here and click ok -> ok -> ok.
- Verify the installation by typing **kotlinc in the command prompt.