Creating and running a first application
::echo before %JAVA_OPTS% set JAVA_OPTS= ::echo after %JAVA_OPTS% rem set _BIN_DIR= rem for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi rem set _KOTLIN_HOME=%_BIN_DIR%.. set _BIN_DIR=O:\4Lrn\Kotlin\kotlinc_1.1.51\bin\ set _KOTLIN_HOME=O:\4Lrn\Kotlin\kotlinc_1.1.51 set JAVA_HOME=D:\Program Files (x86)\Java\jdk1.8.0_20
Creating and running a first application Create a simple application in Kotlin that displays Hello, World!. Using our favorite editor, we create a new file called hello.kt with the following: fun main(args: Array<String>) { println("Hello, World!") } Compile the application using the Kotlin compiler $ kotlinc hello.kt -include-runtime -d hello.jar The -d option indicates what we want the output of the compiler to be called and may be either a directory name for class files or a .jar file name. 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 Run the application. $ java -jar hello.jar