1. Home
  2. Training Library
  3. Environment Setup

Environment Setup



The course is part of this learning path

Installing Java Development Kit (JDK)

This brief course will walk you through how to set up the environments necessary for following along with the Android App Development with Kotlin learning path.


All right friends, glad to have you back. So, in this lesson, we're going to prepare our computer to write code in order to develop Android applications using the Kotlin programming language. Now for this, we will first install the JDK or Java Development Kit. Now earlier, remember we said that this Kotlin language runs on the Java Virtual Machine. So therefore, in order to develop applications using Kotlin, we will need to install JDK onto our computer. Now, before we move onto the JDK installation, I would like to briefly explain the concepts  of a Java Development Kit that we refer to as JDK, a Java Virtual Machine or JVM, and Java Runtime Environment or JRE. So, this Java Development Kit, it's a software development environment, and it's used to develop Java applications.

This package contains all the tools that you need to develop with Java. If you want to develop and run applications, you will need to install JDK onto your machine. It actually includes Java Runtime Environment and other developmental tools. Development tools are things like compilers, Java Debugger, and other things that you'll learn. The JRE or Java Runtime Environment. This is a software package that combines libraries, the Java Virtual Machine, and other components to run applications written in Java. So, the JRE is a runtime portion of Java, and this is all you need to run it in your web browser. Includes Java Virtual Machine or JVM and libraries. So, the Java Virtual Machine is a virtual machine that runs Java programs.

So, when we run the Java program, the Java compiler first compiles your Java code to bytecode. And you get this bytecode by compiling the .java files into .class files. .class files contain bytecode understood by the JVM. So in short, if you are a Java or Kotlin programmer, you will need the JDK to develop and run applications. And this package will also include the JRE and the JVM. So, there you go. That's a brief little overview about the JDK. So, we'll move on to JDK installation. So first up, you just have to open your browser, and here I'm using Google Chrome, but I think you can use any browser you want. Don't let's get too extreme here. Anyway. Now, let's write download JDK in the search bar. So, after pressing the 'Enter' key, I'll just open the first of the results, namely, the Java Standard Edition| SE Downloads Oracle Technology Network page. So if you notice, the most up to date version of Java is Java 16. Now, if you do see another version here, don't worry about it, the JDK installation is the same in all versions. So, you can successfully complete the JDK installation just by following the next steps. So, I'll click on 'JDK download' and that's the link in the Oracle JDK section here. So this page it opens, this is the Oracle JDK page. I want you to notice, there's an important warning text here. Oracle JDK changed its license April 16, 2019. So, in other words, while personal and development JDKs  were free, those used for commercial purposes have become paid. So, for that reason Oracle offers us the Open JDK version which is open source. That's why I'm just clicking on the 'jdk.java.net' link here.

So, from this page it opens, I'll choose JDK 16  which is the most up-to-date and ready-to-use version. Now, from this page we can download the appropriate JDK for our computer. And as you can see, there are JDK installation files for Linux and Mac and Windows. Now, my computer is operating with Windows 64 bit, so that's why I choose the 'zip' option from here. And you can see that my download has started, I hope yours has too. So of course, depending on your Internet speed, it could take some time to download. So, I am just going to stop screen recording here, and then I'll come back when the download is complete, and we'll just continue where we left off. Happy downloading. All right my friends, so my download is complete. So, I'll continue by clicking on the arrow icon right here and select 'Show in folder'.

So now, I'll need to extract this file here. Now, of course you have to have a compression or decompression programme on your computer to be able to do this. If not, you can always download it from the link that I've added right into the resources of this lesson. Now, I'll just right click on the zip file and select 'Extract here'. So as you can see, we've obtained a JDK folder, and now we will move the JDK folder to the Java folder that we will create in the programme files folder. So for this, I'll just cut JDK folder by pressing 'Ctrl' +  'X' on the keyboard. And let's open up Program files by selecting 'This PC' and 'Local Disk (C:)', and now let's create a folder called Java here. So I'll right click with my mouse, select 'New', 'Folder'. I'll just name this file Java. So, now I'm pasting the jdk folder that you saw me download earlier.

All right so, we have now installed the JDK on the computer, but we do have one last step to do. We need to define the path of the java.exe file in the jdk folder here to the operating system. So for this, I can just open up jdk folder, and I also opened up the bin folder. All right so, let's find the Java file here. So, I found the java file, now let's define the path of this file to the system. So first, I just click on the address bar, at the top of the window, and copy the file path here by pressing 'Ctrl' + 'C' right here on the keyboard. Now, let's define this file path to the system. So, I'll right click on 'This PC' from the left side, and select the 'Properties' option from the dropdown menu. And from this window that opens, well, you can learn some of the basic information about your operating system. Should you need to.

So now, I'll select the 'Advanced System Settings'  option right on the right. I'll select the 'Environment Variables' option from the 'System Properties' window that opens. If you notice, there are two different sections here, we're going to use the bottom section, namely, 'System Variables', to define the JDK to the system. So that means, after selecting the 'Path' option from the section here, I choose the 'Edit' option. And here, we'll just paste the path to the 'Java' file in the 'bin' folder. So to do that, I'll select the 'New' option and paste the file path we just copied by pressing the 'Ctrl' and 'V' keys together on the keyboard in this field that opens. So that way, we have now defined the JDK file to the system.

So, the meaning of this process is just like this: If you want the operating system to run Java, the operating system has to know where the java.exe file is.  Otherwise, it's not going to be able to run it. So for this reason, we have defined the folder where the java.exe file is located on our operating system. And finally, I can press the 'OK' button, so I press 'OK'  once again, and there you have it, my friends. You've just watched me complete the JDK installation necessary to develop applications using Kotlin. I hope you did it along with me. If not, catch up and install it because we're just going to take a short break here, and in our next lesson, we're going to install the Integrated Development Environment or IDE for Android Studio. And this, of course, will be necessary to develop Android applications. All right? See you in the next lesson.


About the Author
Learning Paths

Mehmet graduated from the Electrical & Electronics Engineering Department of the Turkish Military Academy in 2014 and then worked in the Turkish Armed Forces for four years. Later, he decided to become an instructor to share what he knew about programming with his students. He’s currently an Android instructor, is married, and has a daughter.

Covered Topics