Installing IntelliJ IDEA and the Kotlin toolchain
This lesson gets Kotlin running on your machine. There are two ways to do it, and you should do both: the IDE (IntelliJ IDEA) for real work, and the command-line compiler so you understand what the IDE is doing for you. Skipping the second is why some developers are helpless the moment the IDE misbehaves.
Expect this to take twenty minutes and one or two things to go slightly wrong — a download that stalls, a version that differs from the screenshot. That is normal. Read the error, and the rest of this lesson anticipates the common ones.
IntelliJ IDEA — the IDE you will actually use
Kotlin comes from JetBrains, who also make IntelliJ IDEA, so the IDE support is the best there is — better than any editor's Kotlin support, and worth using even though it is heavier than a text editor.
- Go to the IntelliJ IDEA download page and download the Community Edition. It is free and open-source, and it has everything this course needs. The paid Ultimate edition adds web and enterprise features you will not use here.
- Install it the normal way for your operating system (drag to Applications on macOS; run the installer on Windows; on Linux, the Toolbox App or your package manager).
- Launch it. On first run it will offer to download components — accept the defaults.
You do not install Kotlin separately for IDE work. IntelliJ bundles the Kotlin plugin and a Kotlin compiler, so a new Kotlin project works immediately. This is one of the real conveniences of staying in the JetBrains ecosystem.
The JDK
Kotlin runs on the JVM, so it needs a JDK (Java Development Kit) underneath. IntelliJ can download one for you when you create your first project — it offers a dropdown of JDK versions, and any recent LTS version (17 or 21) is fine. Accept its suggestion. If you ever see "Project SDK is not defined", this is the thing that is missing, and the fix is to point the project at a JDK in File → Project Structure → Project.
The command-line compiler — so you know what is happening
The IDE hides the compiler. Installing it yourself, once, demystifies everything that follows.
On macOS with Homebrew:
brew install kotlin
On Linux / macOS with SDKMAN (recommended if you will juggle JVM versions):
curl -s https://get.sdkman.io | bash
sdk install kotlin
On Windows, use SDKMAN via WSL, or Chocolatey (choco install kotlinc), or download the
compiler from the GitHub releases and add its bin
folder to your PATH.
Verify it worked:
kotlinc -version
You should see something like info: kotlinc-jvm 2.x.x. The exact version does not matter for this
course — anything 1.9 or newer behaves identically for everything we do. If the command is "not
found", the compiler's bin directory is not on your PATH; that is the single most common setup
problem, and the fix is to add it.
kotlinc needs a JDK too. If brew install kotlin or SDKMAN did not pull one, install a JDK — brew install openjdk, sdk install java, or your platform's package — and confirm with
java -version.
The pieces, and how they fit
It is worth having the mental model straight, because "which tool did what" confuses beginners:
your .kt source ──kotlinc──▶ JVM bytecode ──java (the JVM)──▶ runs
▲ ▲
the compiler the runtime (from the JDK)
- The JDK provides the JVM (to run bytecode) and Java's standard library.
- The Kotlin compiler (
kotlinc) turns your.ktfiles into JVM bytecode. - IntelliJ IDEA bundles both and adds the editor, error highlighting, refactoring and the run button — it is a convenience over the compiler and JVM, not a replacement for understanding them.
Which to use when
- For every real exercise and the capstone: IntelliJ. The autocomplete, instant error underlining and one-click run are exactly what makes learning fast, and they are what you will use professionally.
- For a five-second experiment: the command line or a scratch file (the next lesson). Sometimes
you just want to check what
1 / 2evaluates to without creating a project. - Never fight the tools. If IntelliJ is indexing (a progress bar bottom-right), let it finish before expecting autocomplete. Much "the IDE is broken" is "the IDE is still thinking".
Common problems, pre-empted
- "kotlinc: command not found". The compiler is installed but not on your
PATH. Find where it landed (brew --prefix kotlin, or the SDKMAN candidates folder) and add itsbintoPATH. - "JAVA_HOME is not set" / "no JDK". Install a JDK and, if needed, set
JAVA_HOMEto point at it.java -versionmust work first. - IntelliJ is slow on first launch. It is downloading components and indexing. This is a one-time cost; subsequent launches are quick.
- A different Kotlin version than a tutorial shows. Almost never matters. Kotlin is careful about backward compatibility; the code in this course runs on any recent version.
Check your work
The IDE this course uses, and its edition. IntelliJ IDEA Community Edition — free, and enough.
Whether you install Kotlin separately for IDE work. No — IntelliJ bundles the Kotlin plugin and compiler.
What Kotlin needs underneath, and why. A JDK, because Kotlin runs on the JVM.
How to verify the command-line compiler. kotlinc -version.
The most common command-line setup problem. The compiler's bin is not on PATH ("command not
found").
The three pieces and their jobs. JDK (JVM + Java library), kotlinc (compiles .kt to
bytecode), IntelliJ (editor + convenience over both).
When to use the command line rather than the IDE. A quick throwaway experiment.
What "the IDE is broken" often really means. It is still indexing — let it finish.
Practice
- Install IntelliJ IDEA Community Edition and launch it successfully.
- Install the command-line compiler and run
kotlinc -version. Note the version. - Run
java -versionand confirm a JDK is present. If not, install one. - Deliberately mistype
kotlincaskotlnccand read the "command not found" error, so you recognise it later. - In IntelliJ, open File → Project Structure → Project and find where the JDK is set. You do not need to change it — just know where it lives.
- Draw the source → bytecode → run diagram from memory and label which tool does each step.
Official documentation
- IntelliJ IDEA — Download — The Community Edition this course uses.
- Kotlin — Command-line compiler — Installing and using
kotlincdirectly. - Kotlin — Get started with IntelliJ IDEA — Creating and running a first project in the IDE.
- SDKMAN — Managing Kotlin and JDK versions on macOS and Linux.
Next: writing and running your first Kotlin program.
Stuck on this lesson?
Being stuck is part of it — but being stuck alone for three days is not. Our internship programme pairs this curriculum with code review and one-to-one help from working developers, and it is free.
About the internship