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.
After that, you will be asked to confirm the selection. Just click on Confirm button.
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.
b. Then, search for Kotlin plugin. Click on install button to install it.
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.
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.
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.
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.
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.
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”.
5. To run the application, select the file and right click on it. Then, Run as => Kotlin Application.
6. You will get output as below.
That’s it. We have successfully gone through different steps to show how to create Kotlin project in eclipse IDE.
how to design a form in kotlin?