Kotlin development requires Kotlin Compiler which requires JVM to be installed already because the Kotlin code is running in top of JVM. In other words
JRE to be installed first and then Kolin Compiler to be installed.
JDK contains the Java Runtime Environment (JRE)
and JRE contains the Java Virtual Machine (JVM).
Kotlin Compiler is the only tool which will be responsible for compiling the Kotlin source code and it will generate a self executable JAR file
with the same name with .jar extension (for example HelloWorld.jar) and rest of the executions
will be handled by JRE with the help of Java Virtual Machine (JVM).
Java Development Kit (JDK) configuration for Windows machine
Ensure your system was already loaded with the
JDK. To check that open the command prompt
and execute the command java -version,
it will show the installed JDK's version in the
command prompt only if exist otherwise download it from the official site and install it manually.
Install the JDK in the following default directory C:\Program Files\Java\jdk1.8.0_221 and you can move the JDK software to another location as per your wish.
Check the JDK is updated the Environment Variable or not, by opening the command prompt and execute the command java -version. It will show the installed JDK's version otherwise follow the below steps to setup the environment variable path.
Set Path of JDK in Windows system environment variables
1. Copy the path of the JDK's bin folder
2. Open the Environment variable dialog using the Windows Run. Press Win + R and run the command rundll32.exe sysdm.cpl,EditEnvironmentVariables
or open the Environment variable by windows search using the search text environment variable
3. Select the Path variable and click the Edit which is under User Variable
4. Click the New button and add the path C:\Program Files\Java\jdk1.8.0_221\bin and finally click the Ok button.
5. Open the new command prompt and execute the command java -version, it will show the installed JDK's version.
6. JDK configuration succussfully completed, let try our first java program in the next chapter.
Kotlin Standalone Command Line Compiler configuration for Windows machine
Ensure your system was already loaded with the Kotlin Compiler. To check that open the command prompt and execute the command kotlin -version, it will show the installed Kotlin Compiler's version in the command prompt only if exist otherwise download it from the official site and install it manually.
Unzip the downloaded version of Kotlin Compiler package in the following directory default directory C:\kotlin and you can move the Kotlin Compiler to another location as per your wish.
Check the JDK is updated the Environment Variable or not, by opening the command prompt and execute the command kotlin -version. It will show the installed Kotlin's version.
Set Path of Kotlin Compiler in Windows
1. Copy the path of the Kotlin Compiler's bin folder
2. Open the environment variables dialog as mentioned above
3. Click the New button and add the path C:\kotlinc\bin and finally click the Ok button.
4. Open the new command prompt and execute the command kotlin -version, it will show the installed Kotlin Compiler's version.
5. Kotlin Compiler configuration succussfully completed, let try our first kotlin program in the next chapter.