For setting up an offline Kotlin environment on your local system, you will need to go through the following sequence of steps:
STEP-1: Installation of Java 8
Since Kotlin runs on JVM, you will need to use JDK 8 or any other recent version for Kotlin development. You can download JDK 8 or any of its latest versions from here. Now, as far as Kotlin’s compatibility with JDK 16 is concerned, for the new Java class type - record - of JDK 16, Kotlin 1.4.30 has experimental record class support. Further, you will have to set the environment variable for Java for its seamless working. Type “java –version” on the command prompt and hit the Enter button to verify your java installation. Successful installation will result in displaying the installed Java version.
STEP-2: Installation of IDE
Install IntelliJ IDEA which is a cross-platform IDE to get a consistent experience on your OS. Refer to this link in case you need an IntelliJ installation guide. For downloading IntelliJ IDEA visit this site of jetbrains. Most probably, you would like to opt for the Community version since it is absolutely free for individual development usage. You can go for any other IDE also, such as NetBeans or Eclipse. Installing the recent software version is recommended. In the case of Eclipse, ensure its configuration by installing Kotlin from ‘Kotlin Marketplace’. Once the installation is complete, you might need to restart your Eclipse.
STEP-3: New Kotlin Project
Open your IntelliJ IDEA window and create a new Kotlin Project. Here, we have named the project as ‘GLKotlin’. Select appropriate SDK version and click on ‘Next’. Finish the corresponding configuration.
STEP-4: New Kotlin File
After creating a new Kotlin Project, you are free to create various new Kotlin files with the .kt extension under the src folder as follows: Select src -> Click on New -> File. Give a name to your file and save it with .kt extension. And there you go! Your Kotlin development environment is all set to use.
You have another option of using the online Kotlin compiler as in this Kotlin Tutorial. Throughout this Kotlin Tutorial we will be running the version 1.5.31 on Kotlin playground.
After creating a new Kotlin Project, you are free to create various new Kotlin files with the .kt extension under the src folder as follows: Select src -> Click on New -> File. Give a name to your file and save it with .kt extension. And there you go! Your Kotlin development environment is all set to use.
You have another option of using the online Kotlin compiler as in this Kotlin Tutorial. Throughout this Kotlin Tutorial we will be running the version 1.5.31 on Kotlin playground.
You can go ahead and try running the pre-written sample code and see the output on the console.