How To Create Kotlin Project In Eclipse

In this tutorial, you will learn how to do kotlin programming in eclipse i.e. you will learn how to create kotlin project in eclipse.

Eclipse is a Java-based open-source integrated development environment used in computer programming. it is most widely used Java IDE. It contains base workspace and an extensible plugin system for customising the environment. It is mostly used for Java programming. But, it may also be used for programming in other languages, via plugin, as well. For example, ADA, ABAP, C, C++, COBOL, D, Fortran, Javascript etc.

This is next part of Introduction to Kotlin Programming language post. You can also visit this for more information.

Now, we are going to create kotlin project in eclipse.

As we mentioned earlier, you would need plugin to program in kotlin programming language. So, we will first install kotlin plugin, then, we will create first project.

Install Kotlin plugin in Eclipse

At this point of time, i am assuming that you have successfully installed eclipse in you system. If not, you can download it from Download page. It is officially recommended, by kotlin developers, to install Eclipse IDE for Java Developers bundle. You should download Eclipse Neon(4.6 or later) for proper functioning.

Now, you can install plugin in you eclipse IDE in either ways mentioned below.
1. You can install kotlin plugin from Kotlin plugin download page. You will see a install button there. Just drag and drop this button into your running eclipse window.

Tutorialwing Kotlin plugin download

Kotlin plugin download

After that, you will be asked to confirm the selection. Just click on Confirm button.

Tutorialwing Confirm kotlin plugin install

Confirm kotlin plugin install

After that, you will be asked to accept the terms and conditions. So, select the “I accept…” and click on finish button.

2.The other way to install Kotlin plugin is through eclipse IDE. Follow steps below to install it.
a. Open eclipse IDE. Go to Help => Eclipse Marketplace… menu.

Tutorialwing kotlin install plugin

Go to Marketplace Via this

b. Then, search for Kotlin plugin. Click on install button to install it.

Install plugin via marketplace

Install plugin via marketplace

NOTE: After installation, Restart your eclipse IDE.Window => Open Perspective… => Other. Select Kotlin and press OK. You will notice that Kotlin perspective window is opened.

Check kotlin plugin installation

Check kotlin plugin installation

If you have successfully opened Kotlin perspective window, it means you have successfully installed Kotlin plugin. Now, You can create Kotlin Application (If you are in Kotlin perspective).




Starting to Create Kotlin Project in Eclipse

Since we have successfully installed kotlin plugin. So, we are able to create a new kotlin project now in eclipse.
Follow the below steps to create any kotlin application in eclipse –

1. Go to File => New => Kotlin Project.

Tutorialwing Create Kotlin project In Eclipse

Tutorialwing Create Kotlin New project In Eclipse

A project will be create which is ready for writing Kotlin code that targets JVM. You will notice that this is same as java project. The difference between java project and kotlin project is that kotlin project is configured with kotlin builder and kotlin runtime library. But, you can also include mix the java code and kotlin code into the kotlin project, if required. Project structure of newly created project will be as below.

Tutorialwing - Kotlin Project Structure in Eclipse

Tutorialwing – Kotlin Project Structure in Eclipse

our next target will to create a new kotlin file and write to print “Hello World”.
2. Select src folder and write click on it. Now, Go to New => Kotlin File and click on it.

Tutorialwing-  Create Kotlin File in Eclipse

Tutorialwing- Create Kotlin File in Eclipse

3. Then, you will be asked to select path of the file and provide name of the file. Enter the detail and click finish. In this tutorial, i have given the file name as hello.kt. However, you can give name as per your choice.

Tutorialwing - Provide File Details

Tutorialwing – Provide File Details




4. Since we have a kotlin file, we can write main routine which is entry point to kotlin application. Just write below code to print “Hello World”.

Code to print Hello World

Code to print Hello World

5. To run the application, select the file and right click on it. Then, Run as => Kotlin Application.

Steps to run the application in Eclipse

Steps to run the application in Eclipse

6. You will get output as below.

Tutorialwing - Kotlin Output in Eclipse

Tutorialwing – Kotlin Output in Eclipse

That’s it. We have successfully gone through different steps to show how to create Kotlin project in eclipse IDE.

One Response

  1. Dwi Ahmad November 17, 2017

Leave a Reply