Since we've discussed and known what Java and its features are, it's time to start with Java and do some practical things. In this module we will learn how to download and set up Java on your machine.
Table of Contents
[hide]JDK is the development environment for software developers which help them in building applications. JDK includes JRE and development tools such as Java compiler, Javadoc, Jar, and Debugger.
Step 1- Navigate to Download Java link for downloading JDK.
Step 2- Click on JDK download present on the right side of the respective version.
Step 3- Choose .exe file according to the Operating System which you are using. Options provided are Linux, macOS and Windows. Example of latest version .exe file for windows 64bit OS. (jdk-14.0.1_windows-x64_bin.exe)
Step 4- After clicking the respective file, a pop-up will appear, where you have to accept the License Agreement by Oracle Java SE. Once you accept the agreement, you can click on the download button below. The file will be downloaded to your system.
Hope you have downloaded the .exe file on your system.
You can finally install this file on your system by clicking on it and following simple installation steps.
Since jdk is installed, we are one step closer to run our First Java Program. Next we need to set the environment variables- mainly JAVA_HOME and PATH variables. These environment variables point to the folder location where Java is installed.
These environment variables point to the folder location where Java is installed. But before learning how to set Java Path, let us know why do we set a Path in Java.
JAVA HOME and PATH are the most important environment variables with the help of which we have access to tools such as javac, java, etc which are present in jdk package. JDK package consists of JRE and development tools which are needed for program to execute.
Currently there are two ways to Set the Path in Java
JDK temporary path can be set easily. Following are the steps to set the path.
Step 1- Press Windows+R to open Run box. Type cmd and then click OK to open a regular Command Prompt.
Step 2- Copy the path of JDK/bin directory
Step 3- Type the following command in command prompt
Finally your Java Temporary Path is Set
JDK temporary path can be set easily. Following are the steps to set the path.
Step 1- Press Windows+R and type this command -rundll32.exe sysdm.cpl,EditEnvironmentVariables
Environment variable tab will be open, you can also navigate to environment variable from System properties -> Advanced system settings -> Environment variables. This method is preferable.
Step 2- From Environment variable window click on New from user variable section.
Click OK, now your permanent path is set. You can run any Java program from any drive now.