Installation of JDK (Java development Kit) on Windows
Basically, there are two sources to install Java. The first one is the official Oracle repository which allows us to use the JDK legally depending on the use we give it. The second way to install the JDK is through a release of OpenJDK. This option ensures that you are using a 100% legal version of Java. In this tutorial, we will see the installation from the OpenJDK source.
Installation
The first step is to download the version of the JDK you want to install from the following official OpenJDK website.
For the purpose of this tutorial, we will install version 14 of the JDK. Remember that this version is not LTS (Long term support) so its support is for 6 months. I personally recommend installing only LTS versions. The latest LTS version of the JDK is 11.
After downloading the file for Windows/x64, we must extract the compressed file and the resulting folder (in our case jdk-14), which must be placed in C:\java
. After this, you must add two environment variables to the system which are the following:
Variable | Value |
---|---|
JAVA_HOME | C:\java\jdk-14 |
PATH | C:\java\jdk-14 |
The first one is for some applications to know where the Java installation is located. The second is to be able to execute commands from the terminal. Once this is done, you must verify the installation by running the following command in the terminal.
someuser@mypc$ java --version
openjdk 14 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)