Category: Kotlin Tutorial

https://w7.pngwing.com/pngs/699/399/png-transparent-kotlin-programming-language-java-jvm-android-development-kotlin-logo-3d-icon-thumbnail.png

  • Kotlin Environment Setup (Command line)

    Prerequisite

    Since Kotlin runs on JVM, it is necessary to install JDK and setup the JDK and JRE path in local system environment variable.

    To setup Kotlin for command line, you have to pre install JDK 1.6+ or above. To install JDK and set path of JDK and JRE refer link Set Path in Java .

    Setup Kotlin for Command Line

    To setup Kotlin for command line, we need to go through following steps:

    1. Download the Kotlin Compiler from GitHub Releases https://github.com/JetBrains/kotlin/releases/tag/v1.2.21 .

    Kotlin Environment Setup Command line

    2. Extract downloaded zip in any of system location (in my case it is in C drive).

    3. Copy the path up to bin directory of kotlinc.

    Kotlin Environment Setup Command line 1

    4. Open Computer properties and click Environment variables.

    Kotlin Environment Setup Command line 2

    5. Click on edit path

    Kotlin Environment Setup Command line 3

    6. Past the path of kotlinc bin directory in variable value.

    Kotlin Environment Setup Command line 4
  • What is Kotlin

    Kotlin is a general-purpose, statically typed, and open-source programming language. It runs on JVM and can be used anywhere Java is used today. It can be used to develop Android apps, server-side apps and much more.

    History of Kotlin

    Kotlin was developed by JetBrains team. A project was started in 2010 to develop the language and officially, first released in February 2016. Kotlin was developed under the Apache 2.0 license.

    Features of Kotlin

    • Concise: Kotlin reduces writing the extra codes. This makes Kotlin more concise.
    • Null safety: Kotlin is null safety language. Kotlin aimed to eliminate the NullPointerException (null reference) from the code.Interoperable.
    • Interoperable: Kotlin easily calls the Java code in a natural way as well as Kotlin code can be used by Java.
    • Smart cast: It explicitly typecasts the immutable values and inserts the value in its safe cast automatically.
    • Compilation Time: It has better performance and fast compilation time.
    • Tool-friendly: Kotlin programs are build using the command line as well as any of Java IDE.
    • Extension function: Kotlin supports extension functions and extension properties which means it helps to extend the functionality of classes without touching their code.