Create New Kotlin Project
This tutorial will teach us how to create a new Kotlin project using IntelliJ IDEA IDE. Kotlin is an object-oriented, statically typed programming language created by JetBrains company.
JetBrains introduced the Kotlin language in 2011. JetBrains is also popular for developing integrated development environment tools like IntelliJ IDEA, PyCharm, PhpStorm, etc. In 2017, Google, Inc endorsed Kotlin as an official language for Android development.
Pre-requisite
To get started, we can download and install IntelliJ IDEA. Steps to install the free Community Edition of JetBrains’ IntelliJ IDEA on Windows are as follows:
https://www.testingdocs.com/download-intellij-ide-on-windows-11/
New Kotlin Project
We will create a sample project to print Hello World. The steps to create a new project using IntelliJ IDEA are as follows:
- Launch IntelliJ IDEA.
- Create a new project.
- Select the Kotlin Multiplatform from the project generators list.
- Give a name to the project.
- Select the Kotlin/JVM Console application from the Project template list.
- Click on the Next button.
In the next screen select the target JVM and the unit testing framework for the application. You can leave the default options like:
JDK 1.6 and JUnit 5
This will create and build the Kotlin/JVM project.
The following project structure and the Main.kt file with the following main function code to print Hello, World onto the console would be created for you.
fun main(args: Array<String>) {
println(“Hello World!”)
}
Run the Project
To run the code, click on the green button on the main function and choose Run MainKt. Alternatively, we can choose the following menu option.
Run >> Run Main.kt
This will build the project and run the code, and the message will be displayed on the console window.
That’s it. We have successfully created a new Kotlin project using IntelliJ IDE on the Windows system.
—
More information on the Kotlin programming language: