Forrest logo
back to the kotlinc tool

kotlinc:tldr:01b8f

kotlinc: Start a REPL (interactive shell).
$ kotlinc
try on your machine

The command "kotlinc" is used to invoke the Kotlin compiler from the command line. It is used to compile Kotlin source code files (with the .kt extension) into bytecode that can run on the Java Virtual Machine (JVM).

When you run "kotlinc" followed by the name of a Kotlin source file, the compiler compiles the code and generates a .class file. By default, the .class file will have the same name as the source file but with the .class extension.

The "kotlinc" command provides options and flags that can be used to configure the compilation process. For example, you can specify the output directory for the compiled files, enable additional compiler optimizations, or enable experimental language features.

Here are some common options that can be used with the "kotlinc" command:

  • -d : Specifies the output directory for the compiled .class files.
  • -include-runtime: Includes the Kotlin runtime library when creating the .jar file.
  • -jvm-target : Specifies the version of the JVM to target.
  • -verbose: Prints detailed information during the compilation process.

Overall, "kotlinc" is a command-line tool that compiles Kotlin source code into bytecode, allowing you to run Kotlin programs on the JVM.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the kotlinc tool