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

Kotlin IntelliJ IDEA Environment Setup

Kotlin IntelliJ IDEA Environment Setup

IntelliJ IDEA free Community Edition download link:https://www.jetbrains.com/idea/download/

After downloading and installing, we can use the tool to create a project; the creation process requires selecting an SDK, and Kotlin works with JDK 1.6+.

In the dropdown menu on the right, check the Kotlin (Java) checkbox.

Next, let's give the project a name: HelloWorld

Once the project is created, the file structure is as follows, quite similar to Java's.

Next, we click the src folder and create a Kotlin file; it can be named anything, so here we create app.kt

Next, let's write some code in the app.kt file. IntelliJ IDEA provides a template to do this quickly, just type main and press Tab.

Now let's add a line of code to print "Hello, World!".

Next, we can click the Kotlin icon in the top-left corner of the editor and select Run 'AppKt' to run the code:

After a successful run, you can see the result in the Run window.

That's our first piece of Kotlin code running.