- IDEs for Kotlin development
- IntelliJ IDEA
- Android Studio
- Eclipse
- Compatibility with the Kotlin language versions
- Other IDEs support
- What’s next?
- Get started with Kotlin
- Create a Kotlin project without frameworks
- Create a Kotlin Multiplatform project
- Mix Java and Kotlin in one project
- Add Kotlin dependency to an existing JVM project
- Convert Java to Kotlin
IDEs for Kotlin development
JetBrains provides the official Kotlin plugin for two Integrated Development Environments (IDEs): IntelliJ IDEA and Android Studio.
Other IDEs and source editors, such as Eclipse, Visual Studio Code, and Atom, have Kotlin community-supported plugins.
IntelliJ IDEA
IntelliJ IDEA is an IDE for JVM languages designed to maximize developer productivity. It does the routine and repetitive tasks for you by providing clever code completion, static code analysis, and refactorings, and lets you focus on the bright side of software development, making it not only productive but also an enjoyable experience.
Kotlin plugin is bundled with each IntelliJ IDEA release.
Read more about IntelliJ IDEA in the official documentation.
Android Studio
Android Studio is the official IDE for Android app development, based on IntelliJ IDEA. On top of IntelliJ’s powerful code editor and developer tools, Android Studio offers even more features that enhance your productivity when building Android apps.
Kotlin plugin is bundled with each Android Studio release.
Read more about Android Studio in the official documentation.
Eclipse
Eclipse is an IDE that is used to develop applications in different programming languages, including Kotlin. Eclipse also has the Kotlin plugin: originally developed by JetBrains, now the Kotlin plugin is supported by the Kotlin community contributors.
The Kotlin team manages the development and contribution process to the Kotlin plugin for Eclipse. If you want to contribute to the plugin, send a pull request to the Kotlin for Eclipse repository on GitHub.
Compatibility with the Kotlin language versions
For IntelliJ IDEA and Android Studio the Kotlin plugin is bundled with each IDE release. When the new Kotlin version is released, these IDEs will suggest updating Kotlin to the latest version automatically. See the latest supported language version for each IDE in Kotlin releases.
Other IDEs support
JetBrains doesn’t provide the Kotlin plugin for other IDEs. However, some of the other IDEs and source editors, such as Eclipse, Visual Studio Code, and Atom, have their own Kotlin plugins supported by the Kotlin community.
You can use any text editor to write the Kotlin code, but without IDE-related features: code formatting, debugging tools, and so on. To use Kotlin in text editors, you can download the latest Kotlin command-line compiler ( kotlin-compiler-1.9.0.zip ) from Kotlin GitHub Releases and install it manually. Also, you could use package managers, such as Homebrew, SDKMAN!, and Snap package.
What’s next?
Get started with Kotlin
Before you start working with Kotlin, make sure that the plugin is enabled. The plugin is bundled with IntelliJ IDEA and is activated by default. If the plugin is not activated, enable it on the Plugins page of the IDE settings Ctrl+Alt+S as described in Install plugins.
IntelliJ IDEA provides first-class support for Kotlin. It includes Kotlin-specific project templates, coding assistance, refactorings, debugging, analysis tools, and so on. Most of the Java tools are available for Kotlin, so, for example, if you know how to use Java debugger or refactorings, your experience will be enough to use these in Kotlin. In this topic, you will find the instructions to get started with Kotlin in IntelliJ IDEA.
This page covers Kotlin support in IntelliJ IDEA. For the language itself, refer to Kotlin documentation.
Create a Kotlin project without frameworks
This is a general-purpose project without specific frameworks. You will be able to add the necessary frameworks and technologies later at any time.
- On the Welcome screen, click New Project . Otherwise, from the main menu, select File | New | Project .
- From the list on the left, select New Project .
- Name the new project and change its location if necessary.
- Select the Create Git repository checkbox to place the new project under version control. You will be able to do it later at any time.
- From the Language list, select Kotlin .
- Select the IntelliJ build system. It’s a native builder that doesn’t require downloading additional artifacts. If you want to create a more complex project that needs further configuration, select Maven or Gradle. For Gradle, choose a language for the build script: Groovy or Kotlin.
- From the JDK list, select the JDK that you want to use in your project. If the JDK is installed on your computer, but not defined in the IDE, select Add JDK and specify the path to the JDK home directory. If you don’t have the necessary JDK on your computer, select Download JDK .
- Enable the Add sample code option to create a file with a sample Hello World! application.
- Click Create .
Create a Kotlin Multiplatform project
- On the Welcome screen, click New Project . Otherwise, from the main menu, select File | New | Project .
- In the left-hand menu, select Kotlin Multiplatform .
- Select the project template. The template defines the project structure and dependencies. The following project templates are available: JVM
- Console Application : console application with Kotlin/JVM. Use it for prototyping or testing purposes.
For such applications, you can also create projects without frameworks.
- Full-Stack Web Application : full-functional web application using Kotlin/JS for the frontend and Kotlin/JVM for the backend.
- Library : library for sharing common code among different platforms.
- Native Application : application with Kotlin/Native that works as a standalone application under a specific platform.
- Browser Application : frontend application with Kotlin/JS and non-Kotlin backend for browser. If you use Kotlin for backend, the better option is Full-Stack Web Application .
- React Application : frontend application with Kotlin/JS and React UI framework for browser.
- Node.JS Application : a standalone application with Kotlin/JS for the Node.js runtime.
- is essential for projects built with IntelliJ IDEA build system.
- used for coding assistance in projects built with Gradle and Maven
If you don’t have a JDK installed, you can download it right in the dialog.
Mix Java and Kotlin in one project
You can call Java code from Kotlin and vice versa. This enables you to gradually transition a project to Kotlin or use both languages in parallel, for example, by using Kotlin for testing an existing Java codebase.
The peculiarities of Kotlin/Java interop at the language level are not covered in this topic. For detailed information, refer to Calling Java from Kotlin and Calling Kotlin from Java in the Kotlin language documentation.
In order to start using Kotlin in your project, make sure that the Kotlin plugin is enabled and the Kotlin dependency is added to your project.
Add Kotlin dependency to an existing JVM project
- If your project uses IntelliJ IDEA build tool, create a Kotlin file. When a notification appears stating that Kotlin is not configured for the project, click Configure , then select if you want to use Kotlin with Java or JavaScript.
- For other build tools, follow the steps in:
- Gradle
- Maven
- Ant
Convert Java to Kotlin
IntelliJ IDEA allows you to automatically convert your Java code to Kotlin. The resulting code is not supposed to be perfect, however, it may be helpful in some situations.
If you are not satisfied with the result of conversion, you can roll it back with Ctrl+Z .
- Paste Java code in a Kotlin file. In the dialog that appears, click Yes .
- With a Java file open in the editor, go to main menu and select Code | Convert Java File to Kotlin File or press Ctrl+Alt+Shift+K .