kotlinc
kotlin compiler
TLDR
SYNOPSIS
kotlinc [options] files
DESCRIPTION
kotlinc is the command-line Kotlin compiler that translates Kotlin source files (.kt) into JVM bytecode. It can produce either standalone JAR files with the Kotlin runtime bundled via the `-include-runtime` flag, or output class files to a directory for integration with existing build pipelines.The compiler supports full interoperability with Java, allowing Kotlin code to call Java libraries and vice versa. It accepts a target JVM version through the `-jvm-target` option, supports adding external dependencies via the classpath, and can compile multiple source files together. For larger projects, build tools like Gradle or Maven are typically preferred, but kotlinc is useful for quick compilation tasks, learning, and scripting workflows.
PARAMETERS
FILES
Kotlin source files (.kt).-d OUTPUT
Output JAR or directory.-include-runtime
Include Kotlin runtime.-cp PATH
Classpath.-jvm-target VERSION
Target JVM version.-no-stdlib
Don't automatically include kotlin-stdlib.jar and kotlin-reflect.jar in the classpath.-no-reflect
Don't automatically include kotlin-reflect.jar in the classpath.-jdk-home path
Use a custom JDK home directory instead of the default JAVA_HOME.-language-version version
Compile against the specified Kotlin language version (e.g. `2.0`).-script
Evaluate a Kotlin script file (.kts).-nowarn
Suppress all compiler warnings.-Werror
Treat all warnings as compilation errors.-verbose
Enable verbose logging output with compilation details.-version
Display the compiler version.-help, -h
Display usage information.
CAVEATS
Requires JVM. Slow startup. Consider Gradle for projects.
HISTORY
kotlinc is the official compiler for Kotlin, created by JetBrains as a modern JVM language.
