Due to the need for a more effective programming language, Java was created in 1991 by James Gosling from Sun Microsystem Inc. The aim was to provide a programming language that will build and run a program on multiple operating systems. Note that Sun Microsystems was later acquired by Oracle Corporation which is now steering Java programming language. Thus, we can define Java as a general-purpose programming language that enables one to write, compile and debug a program. Also, Java acts as a platform allowing a Java code to run on any operating system with a Java Virtual Machine. Developers can now create reusable code and modular programs using Java scripting language.

Properties of Java

  • Object-Oriented programming language: All elements of Java are objects except the primitive data types.
  • Independent: Java as a platform uses the Java Virtual machine as abstraction, meaning you do not have to access the operating system directly. This makes Java portable and can run unmodified on supported platforms.
  • Memory Allocations: Java handles memory allocation and de-allocation for the created objects.
  • An interpreted and compiled language: Java virtual machine interprets Java source code and has a Hotspot compiler that translates bytecode instructions to native code instructions.

Uses of Java

Java is applied in many areas which include:

  • Embedded systems
  • Web-based applications
  • Big data technologies
  • Cloud-based technologies
  • Desktop GUI applications of Java
  • Gaming applications
  • Software tools
  • Scientific applications
  • Business and enterprise applications

What is Java 17?

We all love it when technology evolves and brings more changes to the modern world. Thus, Java is one of the popular languages that has evolved, leading to the latest Java 17, the current long-term Support (LTS)release. Java 17 was released in September 2021 with the collaboration of Oracle engineers and members of the Java development community worldwide. Java 17 has advanced features and capabilities that help create top-grade applications.

Features of Java 17

  • Sealed classes: Sealed classes give the user the privilege to control which classes or models can implement or extend. Thus, they represent class hierarchies that offer control over an inheritance.
  • Improved Pseudo-Random Number Generators: JEP(Java Enhanced Proposal) 356 provides new interfaces and implementations for Pseudo-Random Number Generators.
  • Pattern Matching for Switch: Improves the expressiveness of Java language by supporting pattern matching for switch expressions and statements.
  • macOS Rendering Pipeline: With Java 17, there is Java 2D internal rendering meant for macOS. This new implementation uses Apple Metal API with zero changes to the existing APIs.
  • Null Pointer Exception: With Java 17, you do not have to guess the pointer which went null since it provides the name of the variables that are null from the exception’s stack trace.
  • RMI Activation removal: In Java 17, RMI activation API has been removed from the platform.
  • Foreign function and memory API: This allows Java developers to access Java code outside the Java Virtual Machine and manage memory.

Install Java 17 (OpenJDK 17) on Void Linux

Before installing OpenJDK17, start by upgrading the Void Linux repositories.

sudo xbps-install -Su

Downloading and Extracting OpenJDK 17

Let’s continue by downloading the JDK 17 .tar.gz file from the Java official store. Consider downloading the archive package on the Void Linux terminal using the wget command.

wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

In the next step, extract the downloaded Java 17 .tar.gz file. Once you have used the below command, the archive package will be extracted successfully.

tar -xvf jdk-17_linux-x64_bin.tar.gz

Configure and Install OpenJDK17

After the Java 17 file is downloaded and extracted, it is vital to carry out the necessary configurations. Let’s start by moving the extracted Java 17 file to opt/jdk17 directory.

sudo mv jdk-17.0.4 /opt/jdk17

Next, we have to set the environment variable. In this case, configure the JAVA_HOME environment variable. Then, add the bin directory to the PATH environment variable.

sudo tee /etc/profile.d/jdk.sh<<EOF
export JAVA_HOME=/opt/jdk17
export PATH=\$PATH:\$JAVA_HOME/bin
export JAVA_HOME=/opt/jdk17
export PATH=$PATH:$JAVA_HOME/bin

Proceed by sourcing your profile using the below command.

source /etc/profile.d/jdk.sh

Verify the location of the JDK17 directory.


Here are the results after checking on the location of the JDK17 directory.

$ echo $JAVA_HOME

To confirm that OpenJDK17 and its runtime have been installed, check on the Java 17 version.

$ java -version
java version "17.0.4" 2022-07-19 LTS
Java(TM) SE Runtime Environment (build 17.0.4+11-LTS-179)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.4+11-LTS-179, mixed mode, sharing)

Test Java 17 (OpenJDK 17) on Void Linux

We will go ahead and test whether JDK17 is working on Void Linux using a simple Java program.

a) Create a Java Program

On the Void Linux terminal, create a Java file using a text editor such as Nano or Vim. In that case, let’s use the Vim text editor and create a Welcome.java file.

vim Welcome.java

After you have entered the above command, a new file will open. Press on the letter i from your keyboard and copy-paste the below text. It is a text that contains the Java class and the text it will print out after compiling and executing it.

public class Welcome {
public static void main(String[] args) {
System.out.println("First Java Program!");

Save the .java file by pressing ESC followed by:wq!.

b) Compile Java File

Next, let’s compile the code above using the javac command.

javac Welcome.java

c) Run Java File

To run a Java 17 program on Void Linux, type the java file name right after the word java.

 java Welcome

Below is the expected output for the java program we created.

$ java Welcome
First Java Program!


JDK 17 is now functioning correctly on your Void Linux system. Continue creating, compiling, and running more Java codes with Java 17. Notably, this article has taken you through the processes of installing, configuring and using JDK17 on the Void Linux operating system. Enjoy using Java 17 and in case of any query, leave a comment.

More resources:


Please enter your comment!
Please enter your name here