LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

kotlin

Run Kotlin scripts and provide a REPL

TLDR

Run a Kotlin script
$ kotlin script.kts
copy
Run a script with arguments
$ kotlin script.kts [arg1] [arg2]
copy
Start the interactive REPL
$ kotlin
copy
Evaluate an expression
$ kotlin -e "println(\"Hello\")"
copy
Run a script with additional classpath JARs
$ kotlin -cp [lib.jar] script.kts
copy
Pass JVM options (e.g., increase memory)
$ kotlin -J-Xmx512m script.kts
copy

SYNOPSIS

kotlin [options] script [args...]

DESCRIPTION

kotlin is the Kotlin runtime command that executes Kotlin scripts (.kts files) directly on the JVM without requiring a separate compilation step. It also provides an interactive Read-Eval-Print Loop (REPL) when invoked with no arguments, allowing you to experiment with Kotlin expressions and statements interactively.The tool can evaluate single expressions from the command line using the `-e` flag, run script files with command-line arguments, and include additional JARs on the classpath for access to external libraries. Since Kotlin scripts run on the JVM, they have full access to the Java standard library and any Java or Kotlin libraries added to the classpath, making it suitable for automation tasks, quick prototyping, and build scripting.

PARAMETERS

SCRIPT

Kotlin script file (.kts).
-e EXPR
Evaluate expression.
-cp PATH
Classpath.
-J ARG
Pass argument to JVM (e.g., -J-Xmx512m).
-nowarn
Suppress warning messages.
-version
Display the Kotlin version.
--help
Display help information.

INSTALL

sudo pacman -S kotlin
copy
brew install kotlin
copy
nix profile install nixpkgs#kotlin
copy

CAVEATS

Requires JVM. Scripts use .kts extension. Slower startup than compiled code.

HISTORY

Kotlin was created by JetBrains in 2011. The kotlin command runs scripts and provides the REPL.

SEE ALSO

kotlinc(1), java(1), gradle(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid