Kotlin From CLI

Resources

Hello World from the CLI

fun main(args: Array<String>) { println("Hello World!") }

Compiling

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

Running

java -jar hello.jar

Running a task

Find Kotlin path with which kotlin.

export PATH=$PATH:/path/from/which/kotlin function kotlinr() { echo Compiling, please wait... kotlinc $1 -include-runtime -d out.jar java -jar out.jar }

After sourcing, you could now run kotlinr hello.kt.