Setup: Your Development Environments¶
Helpful Resources
- About IntelliJ IDEA
- Setup: IntelliJ IDEA
- Setup: Command Line Compiler
- Setup: Eclipse
- Setup: Learners Guides
- About: Android Studio IDE
- StackOverflow: Android Studio vs. IntelliJ
- JetBrains Toolbox App
- EduTools Plugin
- Getting Started With Kotlin
- Manage multiple IDEs & Releases with Toolbox App
- VSCode: Kotlin Language Plugin
- VSCode: Code Runner plugin
- VSCode: Setup for Kotlin Development
1. Introduction¶
What are my development environment options?
Kotlin offers multiple options for development environments:
- IntelliJ IDEA - preferred JetBrains IDE
- Command Line Compiler - pairs well with a text editor
- Eclipse - likely familiar to Java devs
Which one should I use?
After some research, I recommend the following:
-
Install the JetBrains Toolbox App to manage multiple IDE versions (stable, canary releases) or variations. This was a popular developer suggestion on StackOverflow especially when you start moving to Android Studio for native development.
-
Use IntelliJ when you first get started. It's maintained & recommended by JetBrains ("go where the devs are") and has built-in Learners Guides that help you skill up fast. This was also the basis for the Android Studio IDE, so it makes the transition there easier.
-
Setup the Command Line Compiler if you can. If you love text editors or environments like VS Code, this is a fast and lightweight way to write/test basic code. The syntax will be familiar to Java devs, and you can apparently run scripts though I haven't tried it.
2. IntelliJ IDEA: Setup¶
Use JetBrains Toolbox Approach
I'd previously installed Android Studio and IntelliJ IDEA manually. Now, I simply uninstalled those versions and reinstalled them via Toolbox App. The ability to manage multiple IDEs and releases from one dashboard, is priceless! Use the Toolbox App to install IDEA and Android Studio IDEs
Install the EduTools Plugin
The EduTools Plugin allows us to explore learning guides (e.g., Kotlin Koans) directly from the IDE - which also has the benefit of giving you more familiarity with IDE features and tooling, as you practice. Don't forget to restart the IDE after installing the plugin!
2. Kotlin CLI: Setup¶
Install the Command Line Compiler
You have two options:
-
1. Reuse from IDEA: If you had previously installed IntelliJ IDEA, the compiler is already installed in your development environment. You just need to update your
PATH
to make it accessible from external terminals. Read more in this StackOverflow response. Note: If you installed the IDE using the Toolbox App, the location is different. Look for:/Users/<username>/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.5981.155/IntelliJ IDEA CE.app/Contents/plugins/Kotlin/kotlinc/bin
where<username>
is your Mac login. -
2. Install from scratch: Follow this tutorial. On Mac, I used the Homebrew install since it makes it easier to manage updates later with
brew upgrade kotlin
. This also takes care of installing theopenjdk
dependency by default - if you want to use that JDK installation as your default, the install process also provides aPATH
update recommendation.
Configure Visual Studio Code to use the CLI
You can also now use it with a text editor or IDE - including my favorite: VS Code. VS Code has community-built extensions to support Kotlin CLI usage - but you won't get the rich tooling of IntelliJ IDEA. Instead, you get a lightweight way to do quick code fixes, command-line builds and deploys, while staying within your familiar IDE.
I followed the approach recommended here to setup my VS Code:
- Install the Kotlin Language Plugin
- Install the Code Runner plugin
- Verify you have
java
andkotlin
binaries accessible at command line.
Now, open your Kotlin text file (e.g., test.kt
) in VS Code. The Kotlin Language extension activates syntax highlighting and code snippets.
You now have two options to build and run your code:
- Open the VS Code terminal and use
kotlinc
directly. - Use shortcut
Ctrl+Alt+N
orF1 => Run Code
to activate CodeRunner to do this for you.
Validate CLI usage with a simple program
Revisit the CLI tutorial and run your first program. Check out my "First App" post for more details.