Skip to content

Kotlin

Kotlin is a programming language compatible with Java. It is most commonly used for writing applications for Android.

Information

Kotlin is installed on servers by default. As an alternative to the system version of Kotlin, you can use the following guide for a custom installation.

Local installation

Initial configuration

  • The ability to use your own software has been enabled: Binexec.

Installing Kotlin with SDKMAN

  • Download and install SDKMAN:

curl -s "https://get.sdkman.io" | bash

  • Perform the export:
echo 'export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"' >> $HOME/.bash_profile && source $HOME/.bash_profile
  • Install Kotlin:

sdk install kotlin

Running a Test Application

  • Create a file hello.kt with the following content:
// Application displays: "Hello World!"
fun main(args: Array<String>) {
   println("Hello World!")
}
  • Compile the application using the Kotlin compiler:

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

  • Run the test application using Java:

java -jar hello.jar

Kotlin project website
Official Kotlin documentation
SDKMAN website