How to Install Java on Arch Linux

Java is undoubtedly one of the most popular programming languages ever to grace the face of the planet, powering millions of applications both on Linux and Windows platforms.

Java comprises of JRE (Java Runtime Environment) and JDK (Java Development Toolkit). JRE is a set of software applications that help in the deployment of Java applications. JDK is a development environment necessary for the building and compilation of Java applications.

Recommended Read: 6 Best Arch Linux Based User Friendly Distributions of 2019

In this tutorial, we are going to take you through a step by step of how you can install Java on Arch Linux.

Step 1: Check If Java is Installed

To begin with, let’s check if Java is installed in the Arch Linux using the following command.

$ java -version
OR
$ which java 
Check Java Installation on Arch Linux
Check Java Installation on Arch Linux

From the output above, it evident that Java is missing. Let’s now proceed and install both JRE and JDK which both constitute JAVA.

Step 2: Install JRE in Arch Linux

To install JRE (Java Runtime Environment), a first search which versions are available for download using the command.

$ sudo pacman -sS java | grep jre
Search Java Version in Arch Linux
Search Java Version in Arch Linux

To install the latest version of JRE, run the command.

$ sudo pacman -S jre-openjdk
Install Java JRE in Arch Linux
Install Java JRE in Arch Linux

Press Y and hit ENTER to proceed with the installation of JRE and other dependencies.

Step 3: Install JDK in Arch Linux

With JRE installed, we can proceed to install JDK on our Arch Linux system. Once again, let’s search for the versions of JDK that are available for download.

$ sudo pacman -sS java | grep jdk
Search Java JDK Version in Arch Linux
Search Java JDK Version in Arch Linux

The first option is usually the latest version, so to install the latest JDK, run the command.

$ sudo pacman -S jdk-openjdk
Install JDK in Arch Linux
Install JDK in Arch Linux

As shown before, press Y when prompted and hit ENTER to continue with the installation process. This will take a bit more of your time, so some patience will do.

At this point, we have successfully installed JAVA on our Arch Linux system.

To verify that JAVA has indeed been installed, run.

$ java -version
$ which java
Verify Java Version in Arch Linux
Verify Java Version in Arch Linux
Check Java Command Location
Check Java Command Location
Conclusion

In this article, we demonstrated how you can install Java on Arch Linux. You can now proceed and install applications such as Apache Tomcat, Maven, Jenkins, and Gradle.

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

7 thoughts on “How to Install Java on Arch Linux”

  1. If running `java -version` show OpenJDK version “1.8.0_222“.

    Run this command.

    $ sudo archlinux-java set java-13-openjdk
    

    Where 13 should be replaced by the installed version.

    Reply
    • Hey Xyph, OpenJDK and JRE are the building blocks of JAVA. The article takes you through how to install each of those components which will enable you to install, develop and deploy your JAVA applications.

      Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.