Building in Intellij IDEA

This program is relevant for building your first “hello world” and first sample kotlin apps.  However, once you have even hello world running, it is recommended now to move to gradle for building, even when building with Intellij.

The topics for this page:

  • Introduction: why use Intellij at all.
  • The Roles on an IDE
  • What is Building?
  • Installing Intellij and Kotlin.
  • When to Build using Intellij
  • When to Build using Gradle


To install kotlin, the easiest way is to install Intellij IDEA.  Just as ‘idle’ comes with a python install from and provides a GUI environment for typing in and running python programs, Intellij performs the equivalent steps for kotlin programs.

In fact, Intellij can also take over the role as an editor and much more for your python projects as well, which saves keeping two environments for the two different languages. This is not recommended when starting out unless you already use pycharm for python, but worth keeping in mind.

The Roles of an IDE

Hopefully before reading these pages, you have had significant exposure to an IDE for python (or another dynamic language)/ perhaps even using PyCharm from JetBrains.

If you are not already familiar with the role of an IDE, it is already explained in many places. An IDE handles editing, building, debugging and even potentially deploying programs but for more explanations follow the links.  The pages are primarily for people with some experience, moving from other languages to kotlin.

The focus for these pages is how the role of an IDE changes when moving from python (or another interpreted dynamic language) to kotlin. The main difference is that configuring the ‘build’ aspect of a project becomes far more important.

What is Building?

Building is the combining of all the parts of a program into one package ready for the program to run.  Python mostly uses a ‘environment build’ approach, which hides the build in simply programs, just as Intellij does to a lesser extent with Kotlin.

see: Building, no need with Python? For compiled languages like kotlin, the packages (and other resources)  should be combined with the program, so you need a build.  The advantage is that once built, each program contains its own environment, simplifying testing and distribution. See

Build systems have been around for a very long time, and evolution has seen great improvement.  Although some notable large scale python projects like linkedin use build systems, usage in python is scattered so moving to kotlin can be the first exposure to build systems.  Note that in an ideal world, even python project would use the same build system as languages such as kotlin  (as is the case with linkedin).

Installing Intellij and Kotlin.

The only limitation of the official kotlin lang getting started guide is that it is targeted mainly at people who already know java.  First install a Java Runtime Enviroment (JRE). Search “install JRE <your platform>” and you should find clear instructions. For more background read this page, but just installing a JRE is all you need to start.  Note you can install OpenJDK in place of the default with no problems.

Then (after installing JRD/JDK) follow the kotlin-lang “getting started”.
If anyone makes me aware of any problems I will add more comments here.

C-Lion is an alternative IDE for Kotlin, targeted at the production of native applications.  At the time of writing this is a more advanced approach not really suited to those who are not already using kotlin.  TLDR; Use Intelij IDEA before moving to C-Lion for your native apps.

When to build using Intellij IDEA?

tldr: This is what you are using to get “hello world” running

As an IDE, Intellij supports its own internal build system. Intellij also supports the official external build systems of Ant, Maven and Gradle, as well as third parties offering their own build systems to work with Intellij.

If the internal build system of Intellij was a great system, then why support for so many alternatives?  In the end, build systems are an art form of their own, and the sooner a developer moves to a dedicated build system, the better.

The Intellij internal build system is a good choice only for small projects with very simple build requirements.  Once a programmer has mastered an industry standard build system, there is generally no longer any need to ever use the internal build system again.

When to Use Gradle, and when you need Gradle?

Now that Gradle supports kotlin script for its build system, it is best to move to gradle for even the simplest projects.

However, the clear trigger of when you need gradle is when you need to use a package or artifact that provides instructions of how to add the package/artifact via maven or gradle.  There is a work around, but for almost all packages instructions are given to use either gradle or maven to add the resource to your project.

Another case where you would logically use gradle is when building your own artifacts either in the equivalent of hosting a project on pypi or for simply sharing within your own team.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s