Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Setting up the Kotlin Eclipse environment

Setting up the Kotlin Eclipse environment

Eclipse supports Kotlin by Marketplace installing the Kotlin plugin: open Eclipse, choose the Help -> Eclipse Marketplace... menu, and search for the Kotlin plugin:

Then restart Eclipse and choose Window -> Open Perspective -> Other...; if you see the Kotlin option, the installation succeeded.

Creating a new project

Choose File -> New -> Kotlin Project to create a Kotlin project:

Once created, the project structure looks like this:

Next, click the src folder and create a Kotlin file. You do not need to type ".kt" because it is added automatically. You can name it anything; here we create hello

Next, write some code in the hello.kt file. Eclipse provides a template that does this quickly: just type main and press Enter.

Run the application

Then right-click in the hello.kt editor and select Run As -> Kotlin Application to run it:

Once it runs successfully, you can see the result in the Console window.

That's our first piece of Kotlin code running.