Article

Java Guide

By MARTIN Published on | Last updated on

Java is a high-level programming language developed by Sun Microsystems (now owned by Oracle Corporation) in 1995. It is an object-oriented language designed to be platform-independent, meaning that Java code can run on any computer or device with a Java Virtual Machine (JVM) installed. Java is a popular language for building software like enterprise, web, and mobile applications.

Java Components

Java is made up of various components that have specific functions. The following are the essential Java components.

Java Development Kit - JDK

The tools Java developers use to create Java apps.


Contains:

  • JRE
  • JVM
  • and more

Java Virtual Machine - JVM

The runtime environment in which Java bytecode (.class files inside .jar files) is interpreted and executed. The JVM is also responsible for managing memory, garbage collection heap, and more. Java as a platform is platform-independent (.jar files will run on any JVM), but each JVM is written for the system it’ll be running on (Linux, macOS, Windows).


Contains:

  • JRE
  • Java tools like a compiler and debugger
  • and more

Java Runtime Environment - JRE

The software package contains a JVM and other libraries required to run Java on a computer or device.


Contains:

  • JVM
  • Java API

Java API

The pre-written Java code (classes, interfaces, and methods) for developers. For example, the java.lang package contains fundamental classes and interfaces like Object, String, Integer, Boolean, and various exceptions like ClassNotFoundException. There are more advanced things related to time, regex, and much more too.

Versions

The current versioning system of Java is based on a release model including both LTS (Long-Term Support) and non-LTS releases.

Non-Long-Term Support - Non-LTS

Oracle releases a new non-LTS Java version every six months including new features, improvements, and bug fixes. When a new non-LTS is released, the old one will no longer be supported. No support means there won’t be additional updates or fixes for that version.

Long-Term Support - LTS

Oracle aims to release a new LTS Java version every two years that only receives quarterly security, stability, and performance updates. LTS releases lag behind in gaining the latest non-LTS features but make up for it in increased stability and extended support.


An up-to-date timeline for LTS and non-LTS versions of Java can be viewed on Oracle’s website.


More about versions here.

Vendors

While Oracle is the primary owner and developer of the Java programming language and platform, other companies and communities develop and or package their versions of Java. Most will use those alternative versions for better performance or because it doesn’t come with Oracle’s restrictive licensing.


I suggest you use Adoptium.


The Eclipse Temurin binaries are provided at no cost to you by Adoptium to use, forever, under the terms of the “GNU General Public License, version 2 with the Classpath Exception”. You may freely use, modify, and share the code as described in the licenses included in the download. — Adoptium FAQ

How To Install

Vendors provide different installation instructions for each operating system. Generally, one must download and install a file through their operating system’s software manager. The following are popular options.


VendorDownload Instructions
Oraclehttps://www.java.com/en/download/help/download_options.html
Adoptium (formerly known as AdoptOpenJDK)https://adoptium.net/installation/
Microsoft Build of OpenJDKhttps://learn.microsoft.com/en-us/java/openjdk/install
Amazon Correttohttps://aws.amazon.com/corretto/
Azul Systemshttps://www.azul.com/downloads/

Managing Java

Arch Linux

Arch has a built-in tool for managing Java versions called archlinux-java.

Developing With Java

Integrated Development Environment - IDE

While one could write Java software using a plain text editor, almost everyone uses an IDE because they vastly improve the development experience.


Common IDE features:

  • Code completion
    • Suggests code snippets or method names as one types, based on the context of the code, such as the class or object being used, the expected return type, or the available parameters.
  • Automatic formatting
  • Real-time error checking and highlighting
  • Refactoring Tools
  • Code Analysis Tools
  • Build Tools
  • Debugging Tools

It is strongly suggested to use an IDE when developing with Java. The following are popular options.


DeveloperIDE NameDownload InstructionsPrice
JetBrainsIntelliJ IDEA Ultimatehttps://www.jetbrains.com/idea/downloadPaid
JetBrainsIntelliJ IDEA Community Edition (recommended)https://www.jetbrains.com/idea/downloadFree
Eclipse FoundationEclipsehttps://www.eclipse.org/downloads/packages/installerFree
ApacheNetBeanshttps://netbeans.apache.org/downloadFree
MicrosoftVisual Studio Codehttps://code.visualstudio.com/downloadFree

Java is Functionless

A function is generally a reusable block of code that performs a specific task. In many programming languages, functions can exist independently of classes. However, in Java, all code must be contained within a class, and what other languages might call “functions” are referred to as “methods” in Java. Methods are similar to functions but are always associated with a class or object. Therefore, in Java, methods serve the role that standalone functions do in other languages.