How to run a Kotlin program in VSCode

Previous topic on how to install Kotlin command-line compiler - link

Note : This topic is for Kotlin development on VSCode. But you can use any other IDE if you want.

  1. Create one file with .kt extension.
  2. Open that file on VSCode
  3. VSCode provides a couple of extensions for Kotlin. I am using Kotlin Language by mathiasfrohlich
  4. Write you program. e.g. write the below Hello world program in the .kt file :
    fun main(args: Array<String>) { println("Hello World!") }
  5. Open the terminal and use the bellow command to run it :
    kotlinc <your file name>.kt -include-runtime -d <your file name>.jar && java -jar <your file name>.jar