CodeGym /Java Course /New Java Syntax /Installing the JDK

Installing the JDK

New Java Syntax
Level 5 , Lesson 2
Available

1. Programming for grown-ups

Until recently, you only wrote programs on the CodeGym website. This was simple, convenient, and understandable. But you don't think that you will always do this, do you? It's time to start writing programs like an adult, just like real programmers. Somehow people were writing programs before CodeGym was created!

To write a program on your computer without CodeGym, you need to do two things:

  1. Install the Java JDK
  2. Install the Java IDE

What is these things?

Java JDK
A program written in Java is different from an ordinary computer program. An ordinary program contains machine code that can be executed directly by a computer processor and doesn't require any additional manipulation to run.

A program written in Java doesn't contain machine code. Instead, it contains special bytecode. The processor doesn't know how to execute bytecode, so when executing a Java program, it first launches a special program, the JVM. And it is the JVM that understands bytecode and knows how to execute it. The JVM is part of the JDK.

Java IDE

Modern programs contain millions of lines of code. It would be impossible to write such programs using a basic text editor. Instead, coders use powerful software tools that greatly speed up and simplify their work.

These programs for creating programs are usually called IDEs. IDE stands for Integrated Development Environment.

There are 3 popular IDEs for writing Java programs:

  1. IntelliJ IDEA
  2. Eclipse
  3. NetBeans

Almost everybody prefers IntelliJ IDEA. Once you get to know it, you will understand why. But first you need to deal with the JVM and JDK.


2. What is the JDK?

JVM stands for Java virtual machine. A regular processor executes machine code, but the JVM executes bytecode This means that the JVM is like a virtual processor/computer.

You'll find that programmers quite often refer to computers/processors as machines. Get used to it: you are also one of them now.

The JVM is good thing, but the JVM alone is useless. Nobody needs a bare processor either. The JVM is typically paired with a set of standard libraries, which include all kinds of collections, lists, and other classes. By the way, a standard library contains several thousands of classes.

The JRE stands for Java Runtime Environment.

The JRE is enough to run lots of Java programs, but it isn't for programmers. For example, the Java compiler is not included in the JRE. And where do you get it?

Java developers have their very own toolkit, the JDK (Java Development Kit). The JDK includes the JRE and the Java-compiler along with other programs that are super useful for Java devs. Here's what the big picture looks like:

The JDK contains the JRE plus tools for Java developers.

The JRE contains the JVM plus a set of standard Java libraries.

The JVM is the Java Virtual Machine.


3. Variants of the JDK

The time has passed when a new version of Java appeared every 3-5 years, and it was a major event. Now a new version of the JDK is released every six months. Google Chrome's example turned out to be contagious :) Additionally, different companies produce their own JDKs.

Microsoft was the first to do this in the late 1990s to crush the increasingly popular Java platform that made programs independent of Windows. Of course, Microsoft lost in court and was forced to release its own more independent Java analogues: the .NET platform and the C# language.

The .NET platform is Microsoft's counterpart to the JRE, and the C# language's initial versions had a one-to-one mapping to the Java language. That said, a lot of water has flowed under the bridge since then.

In any case, today there are several popular JDKs. We are interested in two of them:

  • Oracle JDK is the official JDK from the company that created Java. Corporate use now requires some payment, but it is still free for private use and individual developers.
  • OpenJDK is a free JDK, also released by Oracle. It is the favorite of developers and companies that don't want to pay money to Oracle.

For developers, there is no fundamental difference, so you can safely use OpenJDK.


4. Installing the JDK

You need to download OpenJDK 16 to your computer. First, go https://jdk.java.net/16/

In the "Builds" section, click on the JDK version for your OS to start the download.

It's a good idea to move the downloaded archive to a safe place before unzipping it in order to be sure you don't accidentally delete it.

IMPORTANT! Be sure you don't have any Cyrillic characters in the path to the JDK. Cyrillic characters will cause problems with launching programs.


5. Video about installing the JDK

We made a special video that covers every possible questions about this process.

Of course, if you still have any questions, you can always ask them on our Forum.

Comments (8)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
tri bui Level 6, Saigon, Viet Nam
28 May 2024
OpenJDK JDK 22.0.1 General-Availability Release
Serge Level 86, Australia Expert
15 October 2023
JDK 21 will be released on the 19 September 2023.
abhishe_kira Level 18, India Expert
26 June 2023
Remember you can download any version of JDK but it would be best if you download the latest one. For now I have downloaded the 2020 version which is the latest for now. And also the plugins of CodeGym( which will be in next lessons ) works fine in this version.
Lars Sjuve Level 5, Haugesund, Norway
22 January 2023
Is it possible for Android tablet users to download programs needed to continue? Windows/ Mac os/Linux seemed to be only listed?
hoomand Level 7, Sydney, Australia
15 January 2023
If you need to easily move between JDKs and want a similar experience to 'pyenv' for example in Python, I highly recommend installing your JDK using https://sdkman.io
Brentachii Level 13, United States of America, United States
30 November 2021
Is the JDK 16 release still the valid JDK that se need to download? It says that "JDK 16 has been superseded. Please visit jdk.java.net for the current version. Older releases, which do not include the most up to date security vulnerability fixes and are no longer recommended for use in production," https://jdk.java.net/16/
Jonaskinny Level 25, Redondo Beach, United States
28 January 2022
I would go to https://adoptopenjdk.net/ and get the latest.
Brentachii Level 13, United States of America, United States
2 February 2022
okay for anyone who wants to know the answer I got. it was to get the most recent version. hopefully, this helps someone who had the same question I had.