Learning how to create a simple (native) executable script using Kotlin
-
Please install a standalone Kotlin compiler. If you are using
*Nix, you can usebrewwith the following command in your console;brew install kotlin
-
Check if Kotlin compiler already installed with typing
kotlincin your console
-
Kotlin script has two different executables, you can use Kotlin compiler or Native compiler based on your needs 😄
-
If you are using Kotlin compiler, please create a Kotlin file with extension
.ktsand compile it in your console using the following command;kotlinc -script your_file.kts -
If you are using Native compiler, please build the project using
gradlewrapper command like this;./gradlew clean build -
Then run the
.kexeextension from your console using the following command;./gradlew runDebugExecutableMacos./gradlew runReleaseExecutableMacos -
For other operating system, please change the
suffixinstead 😄