Installing Java

Introduction

The JDK is the Java Development Kit

Code written in Java is compiled by the javac compiler into Java bytecode.

.java → .class

Java bytecode is the same for all systems, no matter whether Windows you have Linux or Mac

For this bytecode to work on a particular OS, you must first use the Java Standard Edition (SE) API and then, when all the necessary calls are made, the Java Virtual Machine (JVM) starts and with its help the system understands what needs to be done.

Download Java SE JDK

You can download the latest version of the JDK from the website jdk.java.net Select Ready for use:

Find the Builds and choose the version for your operating system.

Download the archive, it will be named something like this:

openjdk-14.0.2_windows-x64_bin.zip

If you are on Windows - unpack this archive into C:\Program Files

A directory jdk-XX.X.X will appear in Program Files , where XX.X.X is the version. In my case it is jdk-14.0.2

Inside there will be the following folders: bin, conf, include, jmods, legal, lib and the release file

System variables

Copy the path to the contents of the jdk-XX.X.X folder, I copied

C:\Program Files\jdk-14.0.2

Add

C:\Program Files\jdk-XX.X.X\bin

to the Path system variable. You can read how to do this in the article «System variable PATH»

Create a new system variable JAVA_HOME and paste the value C:\Program Files\jdk-XX.X.X

Check the version

Open the command line and run

java -version

openjdk 14.0.2 2020-07-14 OpenJDK Runtime Environment (build 14.0.2+12-46) OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

Obviously, in the example above the JDK version is 14

If you got, for example

openjdk version "1.8.0_41" OpenJDK Runtime Environment (build 1.8.0_41-b04) OpenJDK Client VM (build 25.40-b25, mixed mode)

Then you have version 8, update number 41

Article author: Andrei Olegovich