Getting Started with Eclipse Luna
|Last Updated||28 March 2015|
Setting up the environment
We're assuming Eclipse is installed. If not, it can be download from the download page. The "Eclipse IDE for Java Developers" bundle is recommended. For correct functioning, Eclipse Luna S22 (4.4.2) or later is required.
We recommend installing Kotlin plugin from Eclipse Marketplace. One option is to drag-and-drop this button into a running Eclipse window:
Alternatively, use the Help -> Eclipse Marketplace… menu and search for Kotlin plugin:
A more old-fashioned way is using an update site directly:
Once Eclipse has been restarted, we can check to make sure the Kotlin plugin is installed correctly, by opening the Kotlin perspective
in main menu
Window -> Open Perspective -> Other...
Creating a new project
Now we are ready to create a new Kotlin project.
Select File -> New -> Kotlin Project to proceed.
A fresh Kotlin project Package Explorer should look something similar to the following:
We can now create a new Kotlin file under the source folder.
IF omitting the ".kt" extension in file name, Eclipse will add it automatically
Once we have the file created, we need to type the main routine, which is the entry point to a Kotlin application. We can simply type main, invoke completion and hit 'Enter'
Finally we add a simple line of Kotlin code to print the message:
Running the application
The easiest way to run the application is to do a right-click somewhere in the main file and select Run As -> Kotlin Application
If everything has gone well, the console window output should automatically open, showing the results.
We now have our first Kotlin application running in Eclipse.