Setting Up Your Development Environment
Prerequisites: Installing Kotlin
Kotlin is made by JetBrains, and its best editor support is in their IDEs:
- IntelliJ IDEA — for general Kotlin: command-line programs, back ends, and libraries.
- Android Studio — for Android apps.
Both give you autocomplete, instant error highlighting, refactoring, debugging, and one-click running.
Your first project in IntelliJ IDEA
- File → New → Project, choose Kotlin, give it a name.
- Choose Gradle as the build system (with the Kotlin DSL), and let it download a JDK if you don't have one.
- Open
src/main/kotlin/Main.ktand click the green ▶ next tofun main()to run it.
The output appears in the Run panel at the bottom of the window.
A build system (Gradle) compiles your code, downloads libraries, and runs tests. You don't need to understand it yet — Level 2 has a Gradle lesson.
Handy editor features
- Alt + Enter (⌥↩ on macOS) shows quick fixes for the code under the cursor — often exactly what you need when something is underlined.
- Inlay hints show the types Kotlin has inferred for your variables, which is a great way to learn how type inference works.