THIS IS MARKDOWN FILE AS TO VSCODE SETTING FOR KOTLIN.
If you have trouble installing and setting VSCode, you can consider the online playground - https://try.kotl.in/
You need to install:
- Java -> I've installed
24.0.1. - Kotlin Compiler -> I've installed
kotlinc-jvm 2.3.20. - Code Runner in VSCode, Kotlin Language Extension
This repo is just for exercising kotlin (not for developing Android app), and thus I've chosen VSCode rather than Android Studio. It is because VSCode is lighter than Android Studio.
Link
- open JDK: https://openjdk.org/
- Oracle JDK(WHAT I SELECTED): https://www.oracle.com/java/technologies/downloads/
I selected 'Windows -> x64 Installer'.
You'll get an .exe file, and your files would be installed at 'C:/Program Files/Java/jdk-24'(default).
Now, please set an environment variable.
You need to make a variable 'JAVA_HOME'.

And then, double-click system variable 'Path'(not user variable).
Register a new value "%JAVA_HOME%\bin".
Well, let's check whether JDK is fine.
Turn on 'cmd', and try typing 'javac -version'.
You must be able to see the version of javac.

Link: https://github.com/JetBrains/kotlin/releases
Take scrolling down, and download 'kotlin-compiler-x.x.x.zip'. You can set the target path at which you download .zip file.
Unzip the .zip file, and find the folder 'bin'.

Don't forget to set the system environment variable in the same way as in the case of JDK!
Type the path to folder 'bin'.
In the same manner as in JDK, you can check whether Kotlin Compiler (kotlinc) is installed successfully, typing 'kotlinc -version' into 'cmd'.
Now, let's turn on VSCode to install two extensions.
This extension is helpful in that it allows you to easily run various programming languages (including Kotlin) and check the results.
It features syntax highlighting, code snippets, and region code folding.
In VSCode, go into 'setting', search 'code-runner', and click the editing button highlighted in the below image.

Please add key "kotlin" and its corresponding value:
- "kotlin": "cd $dir && [Path to kotlinc in the installation file of kotlinc '...\kotlinc\bin\kotlinc'] $fileName -include-runtime -d $fileNameWithoutExt.jar && java -jar $fileNameWithoutExt.jar",
Create a new .kt file, and then write down the following code.
Now, click the button 'Run Code' or use shortcut ctrl+alt+n.
If being successful, you can look at a few lines of output, as follows:







