How to compile and run kotlin code using cmd.



In this tutorial we are going to see how to compile and run kotlin code using cmd. So Let’s Begin…



First you need to setup an environment variable that i have shown in previous video Click here

Step 1: Open any text editor and write the following code.

fun main(args: Array<String>) {
println(“Hello Dream Developers”)
}


Step 2: save the file with .kt extension.

Step 3: open cmd and go to the file saved location.


Step 4: to compile the code type following command in cmd. 

kotlinc hello.kt -include-runtime -d hello.jar

Here, hello is the file name with kt and jar extension.


Step 5: To run the file type following command. 

java -jar hello.jar

Here, hello is file name with jar extension.

Thank you !!!

Like || Share and Subscribe on youtube.


Post a Comment

0 Comments