Kotlin: A Statically Typed Language for the JVM
Kotlin is JetBrains' statically typed language that compiles to JVM bytecode, JavaScript, and native binaries. Reach for it if you're writing Java or Android code today and want null safety, coroutines, and concise syntax without abandoning your existing build tooling. Skip it if your team has zero JVM experience — the learning curve assumes comfort with Gradle and IntelliJ IDEA first.
What is Kotlin?
Kotlin is a general-purpose programming language created by JetBrains, first designed as a more concise, safer alternative to Java on the JVM. It has since grown into a multiplatform language: the same codebase can target the JVM, Android, JavaScript, and native platforms via LLVM, with Kotlin Multiplatform letting teams share business logic between Android and iOS builds.
The Java pain points Kotlin solves
Java code that touches a null reference can crash at runtime. Kotlin's type system marks nullable types with a `?`, so the compiler rejects unsafe access before you ever run the code — no NullPointerException surprise three calls deep in a stack trace. Data classes cut the boilerplate of hand-writing equals(), hashCode(), toString(), and getters for a plain value holder. Coroutines replace nested callback code for async work, so sequencing network calls doesn't require pulling in a separate reactive library.
Key language features
- ✓Null safety — nullable types are marked with `?` so the compiler flags unsafe dereferences before you run the code.
- ✓Coroutines — lightweight, suspendable functions built into the language for async work without callback nesting.
- ✓Extension functions — add a method to a class you don't own (including Java classes) without subclassing it.
- ✓Data classes — one declaration generates equals(), hashCode(), toString(), and copy() for a value holder.
- ✓Type inference with static typing — `val x = 5` skips the explicit type but the compiler still enforces it.
- ✓Kotlin Multiplatform — share business logic across Android, iOS, desktop, and web from a single codebase, per the README.
- ✓Direct Java interop — calls existing Java libraries and compiles to the same JVM bytecode.
Building Kotlin from source
The repository builds with Gradle: run `./gradlew <tasks-and-options>` on Unix/macOS or `gradlew <tasks-and-options>` on Windows. Gradle toolchains auto-provision the required JDKs from the Eclipse Adoptium project, or you can point Gradle at JDKs you already have via environment variables listed in gradle.properties. On Windows, the README says to run `git config core.longpaths true` first to avoid path-length failures. The first build downloads `intellij-core` (APIs for the command-line compiler) and a full IntelliJ IDEA Community Edition build (`idea-full`) for the plugin module — the README warns these are large enough to time out on a slow connection, in which case you can raise the timeout with `-Dhttp.socketTimeout=60000 -Dhttp.connectionTimeout=60000`. Building Kotlin/Native is documented separately in kotlin-native/README.md, and some Maven-plugin artifacts build outside Gradle entirely — see libraries/ReadMe.md.
Why developers choose Kotlin
- ✓Compiles to the same JVM bytecode as Java and calls Java libraries directly — no rewrite needed to introduce it into an existing codebase.
- ✓Null safety is enforced by the type system itself, not by convention or a linter you have to remember to run.
- ✓Coroutines cut the boilerplate of async code compared to nested callbacks or a separate reactive library.
- ✓Kotlin Multiplatform shares business logic between Android and iOS from one codebase, per the README.
- ✓Governed by the non-profit Kotlin Foundation rather than a single vendor's roadmap alone, per the README.
Known limitations
- △The first source build pulls a full IntelliJ IDEA Community Edition (`idea-full`) alongside `intellij-core` — the README calls these downloads large enough to time out on a slow connection.
- △Windows builds need an extra `git config core.longpaths true` step the Unix/macOS build doesn't require.
- △Kotlin/Native build instructions live in a separate README (kotlin-native/README.md) rather than the main build doc, and some Maven-plugin artifacts build outside the main Gradle build entirely.
- △The repository documents how to build the compiler from source, not how to install Kotlin for everyday app development — that path isn't covered here.
Kotlin vs Java, Scala, and other JVM languages
When Kotlin is the right choice
Kotlin is the right call for teams already shipping Java or Android code who want to cut null-pointer bugs and verbose boilerplate without switching runtimes — it compiles to the same JVM bytecode and calls existing Java libraries directly. It also fits teams building for both Android and iOS who want one shared business-logic layer via Kotlin Multiplatform instead of maintaining separate codebases. It's a weaker fit for greenfield projects with no JVM constraint, where a language chosen without legacy baggage might be simpler to hire for.
Common questions about Kotlin
Kotlin is distributed under the Apache License 2.0, per the repository's README, so commercial use requires no license fee.
Kotlin welcomes outside contributions — the repository points contributors to its contributing guidelines document before submitting changes.
Kotlin compiles to JVM bytecode, JavaScript, and native binaries through LLVM, covering Android, iOS, desktop, server, and web targets.
Kotlin Multiplatform lets a single codebase share business logic across Android, iOS, desktop, and web, while each platform still gets native UI code — Compose Multiplatform extends that sharing to UI as well.
Kotlin/JVM compiles Kotlin code to JVM bytecode for use in Java-based backends and Android apps, while Kotlin/JS compiles the same language to JavaScript for browser or Node.js targets.
Kotlin builds itself with Gradle and also documents a separate Maven-based build path for some artifacts, primarily its Maven plugin, according to the repository's libraries/ReadMe.md reference.
Best use cases
- •Android app development — Google's preferred language for new Android code, with full interop with existing Java modules.
- •Sharing business logic between Android and iOS — Kotlin Multiplatform ships the shared layer while each platform keeps native UI.
- •JVM backend services that need to sit next to legacy Java code without a rewrite.
- •Gradle build scripts and plugins written in the Kotlin DSL instead of Groovy.
How to use
Useful Gradle tasks once the project is checked out: `clean` wipes build output, `dist` assembles the compiler distribution into `dist/kotlinc/`, `install` builds and publishes public artifacts to your local Maven repository, and `coreLibsTest`, `gradlePluginTest`, and `compilerTest` run the stdlib/reflect/kotlin-test suite, the Gradle plugin tests, and the full compiler test suite respectively. To reproduce a TeamCity build locally, add `-Pteamcity=true` — local builds skip proguard and jar compression by default. Contributors who need a bleeding-edge compiler can pull `-dev` builds by adding the `https://redirector.kotlinlang.org/maven/bootstrap` Maven repository and picking a version from its metadata listing. The README doesn't document a simple end-user install path for writing everyday Kotlin apps — for that, IntelliJ IDEA's own Kotlin plugin is the recommended route it links to.
Related repositories
Curious whether kotlin is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about kotlin.
