Before you start working with Java, the first step is to check whether Java is already installed on your machine or not. There are different ways to check if Java is already installed.
The easiest way is to open the Command Prompt/Terminal in Windows/Mac machine and type in “java -version” and hit enter. If Java is already installed on your machine, then below message will be displayed as you hit enter.
If Java is not installed, then below message will be displayed in Command Prompt or Terminal:
“‘Java’ is not recognized as an internal or external command”.
This is good news as now we will start with JDK installation…
Open Browser and type in “jdk download”. Click on the Java SE Development Kit 8 link to go to Oracle Website download section. Java 8 is the latest version. However, lower versions are also available for download. For now we will download the Java 8 version.
Once you are in below downloads page, select one of the options depending on the machine you are using. Depending on your Windows machine 32 or 64 bit, select Window x86 or Windows x64 option or else if its Mac, select the Mac OS X option. Click to download the exe or dmg file into your machine.
Once after the successful download, click on the file in the Download folder of your machine to proceed with the installation. Installation is straight forward and you will be taken through various prompts to complete the installation. In Windows machine, JDK and JRE will be installed in C:\Program Files folder. In Mac, it will be in /Library/Java/JavaVirtualMachines folder.
Once after complete installation of JDK, you can confirm the installation by going to Command Prompt or Terminal and type in java -version” and hit Enter.
And now the JDK installation is complete, we will move on to the next topic…