Saturday, October 26, 2019

Kotlin IntelliJ IDEA environment setup

IntelliJ IDEA free community version download address: https://www.jetbrains.com/idea/download/index.html
Once the download is installed, we can use the tool to create the project. The creation process requires the selection of the SDK, Kotlin and JDK 1.6+.

Kotlin IntelliJ IDEA environment setup
Check the Kotlin (Java) checkbox in the drop-down menu on the right.
Next we take a project name: HelloWorld


After the project is created, the file structure is as follows, similar to Java.

Next we click on the src folder and create a Kotlin file, which can be named arbitrarily, here we create app.kt

Next, we write some code in the app.kt file. IntelliJ IDEA gives us a template for doing this quickly, just type main and press Tab.

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

Next we can run the code by clicking the kotlin icon in the upper left corner of the editor and selecting Run 'AppKt':

After running successfully, you can see the results in the window Run.

So our first Kotlin tutorial is up and running.

No comments:

Post a Comment