Creating Kotlin Project in Eclipse

In this tutorial I will show you how to create Kotlin project in Eclipse. This example shows you how to create Kotlin gradle project or Kotlin maven project.

Kotlin is statically typed programming language for modern multiplatform applications. Kotlin has 100% compatibility with Java or vice-versa.

Salient Features of Kotlin

Drastically reduces the amount of boilerplate code.

Avoids entire classes of errors such as null pointer exception.

Leverages existing libraries for the JVM, Android and the browser.

Choose any Java IDE or build from the command line.

Eclipse Neon
Gradle or Maven configuration
Java 8 configuration

Please read the following steps in order to create and build Kotlin project in Eclipse.

Step 1. Setup Kotlin plugin in Eclipse. Please follow instructions written here at or you can install the kotlin plugin by downloading from the Eclipse option Help->Install New Softwares and add site URL  to download. Accept the License Agreement. When warning appears, accept it. You need to restart the Eclipse in order to reflect the changes.

kotlin project eclipse

Step 2. Now we are done with the above step and you will find Kotlin configurations added to the Eclipse from option File -> New -> Other -> Kotlin. Now from here onward you will be able to create Kotlin projects, files and many more. In this example, I will show you how to create Gradle based Kotlin project. So I will create Gradle project in Eclipse with the below build.gradle file. Let’s say the project name would be “kotlin”.

buildscript {
	ext {
		kotlin_version = '1.2.31'
	repositories {
	dependencies {
		classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
apply plugin: "kotlin"
repositories {
dependencies {

If you need maven based project then you can add following dependencies to the project’s pom.xml file

                    <goals> <goal>compile</goal> </goals>

Step 3. Now we will build the project from command prompt using the command “gradle clean build”. Once required libraries are downloaded you will see “BUILD SUCCESSFUL” message.

Step 4. Now we will create package “com.roytuts.kt” and under this package we will create Kotlin class file Hello.kt

package com.roytuts.kt
class Hello {
	fun sayHello(name: String): String {
		return "Hello " + name;
fun main(args: Array<String>) {
	val hello = Hello().sayHello("Soumitra Roy")

Step 5. Run the above class by doing right-click on the Hello.kt file and Run As -> Kotlin Application. You will see below output in the console.

Hello, Soumitra Roy
Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *