The Kotlin Toolchain
Running Kotlin: the Gradle Kotlin DSL, the standard library that replaces much of Guava/Apache Commons, the REPL and scripts, and how a Kotlin project is laid out.
On this page
Before writing real Kotlin, get comfortable with the tooling around it - how you build, run, and structure a Kotlin project, and the standard library that comes along. The good news for a Java developer: it's almost entirely tools you already know (JVM, Gradle, IntelliJ) with a Kotlin flavor. This short lesson maps the toolchain so nothing surprises you when the real language work starts.
Building: Gradle's Kotlin DSL
Kotlin projects usually build with Gradle - and there's a pleasant twist: Gradle's build script can itself be
written in Kotlin, the Kotlin DSL (build.gradle.kts), instead of Groovy (build.gradle). For a Kotlin
project this means your build script is in the same language as your code, with full IDE autocompletion and
type-checking on the build itself:
// build.gradle.kts
plugins {
kotlin("jvm") version "2.0.0"
application
}
dependencies {
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") // a Java library, used from Kotlin
testImplementation(kotlin("test"))
}Everything you learned about Gradle in the build tooling context applies; the Kotlin DSL just gives you a type-safe, autocompleted script. (Maven works too via the Kotlin Maven plugin, but Gradle + Kotlin DSL is the idiomatic pairing - and a natural cross-link to the Build & Delivery path.)
Running Kotlin: apps, scripts, and the REPL
Kotlin's entry point is a top-level main function - no class required:
fun main() {
println("Hello from Kotlin")
}Three quick ways to run code while learning:
- A compiled application - the normal path: build with Gradle, run the
mainfunction (theapplicationplugin wires this up). - The REPL -
kotlincwith no file drops you into an interactive shell to try expressions instantly (great for experimenting with a feature). - Kotlin scripts (
.ktsfiles) - runnable scripts without a full project, handy for small automation.
For pure learning and experimentation, the online Kotlin Playground (play.kotlinlang.org) runs snippets in the browser with zero setup - the fastest way to test a language feature you just read about.
The standard library: batteries you used to import
Kotlin ships a rich standard library (kotlin-stdlib) that replaces a lot of what Java developers reach to
Guava or Apache Commons for. Much of it lives as extension functions on the Java types you already use:
val name = " Kotlin ".trim().uppercase() // String helpers built in
val nums = listOf(1, 2, 3, 4) // concise collection factories
val evens = nums.filter { it % 2 == 0 } // functional collection ops, no streams import
val text = listOf("a", "b", "c").joinToString("-") // "a-b-c", no StringJoiner ceremonyCollections, sequences, string utilities, scope functions, ranges (1..10), and null-handling helpers are all in
the stdlib - no extra dependency. It sits on top of the Java collections you know (a Kotlin List is a
java.util.List at runtime), so interop is seamless while the API is far more ergonomic. You'll meet these
properly in the collections module; for now, know they're built in.
Project layout and the IDE
A Kotlin project looks like a Java one: sources under src/main/kotlin (and src/test/kotlin), the same JAR
output, the same JDK. IntelliJ IDEA has the deepest Kotlin support (same vendor), including the invaluable
"convert Java file to Kotlin" action - paste Java code and it becomes Kotlin, a great learning aid and migration
tool (review the result; it's a starting point, not always idiomatic).
Use the Playground and 'Convert to Kotlin' while learning
Two tools accelerate a Java dev's Kotlin learning enormously. The online Kotlin Playground lets you test any snippet in seconds with no setup - ideal for the 'wait, what does this compile to / return?' moments. And IntelliJ's 'Convert Java File to Kotlin' shows you the Kotlin equivalent of Java you already understand - paste a Java class and study the diff. Neither replaces writing Kotlin yourself, but both shorten the feedback loop from 'read about a feature' to 'see it work.'
Picking up the Kotlin toolchain as a Java developer is like switching from one code editor to another that your same company makes - not emigrating to a foreign country. The building (JVM), the roads (Gradle), the electricity (JDK) are all the same infrastructure you already rely on; only the editor's keybindings and a few menus differ, and even those are designed to feel familiar. The Gradle Kotlin DSL is your same build tool speaking your new language; the stdlib is a better-stocked toolbox in the same workshop; IntelliJ is the IDE you likely already use, now fluent in Kotlin too. There's almost no new environment to learn - you're rearranging a workspace you already own, which is exactly why the tooling is the easy part and the language idioms are where the real learning is.
You want to start trying Kotlin features today without disrupting your team's Java project. Describe the quickest zero-risk way to experiment with snippets, then how you'd add Kotlin to an actual Gradle project when ready, and one stdlib convenience you'd expect to replace a common Java utility.
What is notable about a Kotlin project's toolchain for a Java developer?
Key takeaways
- Kotlin projects build with Gradle, and the build script itself can be Kotlin (the Kotlin DSL, build.gradle.kts) - type-safe and autocompleted.
- Run Kotlin as a compiled app (main function, no class needed), via the REPL for quick experiments, as .kts scripts, or in the online Kotlin Playground with zero setup.
- The Kotlin standard library replaces much of Guava/Apache Commons with built-in extension functions on the Java types you already use - collections, strings, scope functions.
- Kotlin collections sit on top of Java collections (a Kotlin List is a java.util.List at runtime), so the API is more ergonomic while interop stays seamless.
- Project layout mirrors Java (src/main/kotlin, same JDK/JAR); IntelliJ has the deepest support, including a 'convert Java file to Kotlin' aid for learning and migration.