Last Updated | 24 April 2019 |
First of all, you need the Eclipse IDE installed on your system. You can download its latest version from download page. The "Eclipse IDE for Java Developers" bundle is recommended.
To add the Kotlin support to your Eclipse IDE, install the Kotlin Plugin for Eclipse. We recommend installing the Kotlin plugin from Eclipse Marketplace. One option is to drag this button into a running Eclipse window:
Alternatively, open the Help | Eclipse Marketplace… menu and search for Kotlin Plugin for Eclipse:
A more old-fashioned way is using an update site directly:
https://dl.bintray.com/jetbrains/kotlin/eclipse-plugin/last/
Once the plugin is installed and Eclipse is restarted, make sure the plugin is installed correctly: open the Kotlin perspective in the menu Window | Open Perspective | Other…
Now you are ready to create a new Kotlin project.
Select File | New | Kotlin Project.
An empty Kotlin/JVM project will be created. For Eclipse IDE, the project is also a Java project but configured with Kotlin nature, meaning it has the Kotlin Builder and reference to the Kotlin Runtime Library. Great thing about this solution is that you can add both Kotlin and Java code to the same project.
The project structure looks like this:
Create a new Kotlin file in the the source directory.
You can enter the name without the .kt extension. Eclipse will add it automatically.
Once you have a source file, add the main
function - the entry point to a Kotlin application. You can simply type main
and invoke code completion by hitting Ctrl + Space
.
Add a simple line of Kotlin code to print a message:
To run the application, right-click somewhere in the main file and select Run As | Kotlin Application.
If everything went well, you'll see the result in the Console window.
Congratulations! You now have your Kotlin application running in Eclipse IDE.
© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/docs/tutorials/getting-started-eclipse.html