Greetings!We have recently published 100+ articles on android tutorials with kotlin and java. If you need, you may visit Android Tutorial for beginners page. You can also check Kotlin Tutorial for beginners
In this tutorial, we will learn about how to create kotlin project in IntelliJ IDEA. We will see the step by step process to create a project in IntelliJ IDEA.
IntelliJ IDEA is java integrated development environment for developing computer software. It is developed by JetBrains. It is available as an Apache 2 Licensed community edition, and in a proprietary commercial edition. Both can be used for commercial development.
Note: This is next part in the Kotlin Tutorial series. You can visit Introduction to Kotlin Programming language tutorial to know more.
Now, we are starting the process to create kotlin project in IntelliJ IDEA.
At this point, we are assuming that you have successfully installed IntelliJ IDEA. If not, you can download and install IntelliJ IDEA from Download IntelliJ IDEA. Kotlin is bundled with IntelliJ IDEA starting from version 15.
Now, we will go through step by step and see how you can create a new project.
Follow steps below to create a new project –
1. if you are at Welcome to IntelliJ IDEA screen, select Create New Project.
2. Select Java Module and Select the SDK. You need JDK 1.6+ to work with Kotlin. So, Select at-least 1.6 version. In the Additional Libraries and Frameworks fields, select Kotlin(Java) option. After entering all details, click Next.
3. In the next screen, Provide project name and select project location where you want to store the project. Then, click Finish.
4. After this, a project will be create. Folder structures of the newly created project will be as below.
5. As you have noticed, there is no kotlin file created yet. So, you need to create a new kotlin file and write you first kotlin program to print Hello World. So, create a new kotlin file. Select HelloWorld(Project Root file) => src folder and right click on it. Now, go to New => Kotlin File/Class to create a new File. We will name this file app.kt. However, you can name it as per your choice. Below image clearly depicts the process.
6. We have successfully create a new kotlin file. Now, our job is to write main routine which is entry point for any kotliin application. IntelliJ IDEA offers a template for this process. Type main and press tab. You will see that a method is created in kotlin file.
7. Now, write the code to print Hello World.
That’s it. Run the application and you will see the output as shown below.
That’s it. We have successfully gone through different steps to create kotlin project in IntelliJ IDEA.