In this tutorial we will create hello world application in kotlin using command line compiler from Github release page.
Every release ships with a standalone version of the compiler. we will download the newest version
Unzip the standalone compiler into a directory and optionally add the bin directory to the system path. The bin directory contains the scripts needed to compile and run Kotlin on Windows, OS X and Linux.
An easier way to install Kotlin on UNIX based systems such as OS X, Linux, Cygwin, FreeBSD and Solaris is by using SDKMAN!. Simply run the following in a terminal and follow any instructions:
$ curl -s https://get.sdkman.io | bash
Next open a new terminal and install Kotlin with:
$ sdk install kotlin
Alternatively, on OS X you can install the compiler via Homebrew.
$ brew update$ brew install kotlin
If you’re on Ubuntu 16.04 or later, you can install the compiler from the command line:
$ sudo snap install --classic kotlin
fun main(args: Array<String>) {println("Hello, World!")}
kotlinc hello.kt -include-runtime -d hello.jar
The -d option indicates the output path for generated class files which may be either a directory or a .jar file. The -include-runtime option makes the resulting .jar file self-contained and runnable by including the Kotlin runtime library in it. If you want to see all available options run
$ kotlinc -help
$ java -jar hello.jar
Quick Links
Legal Stuff
Social Media