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.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

6 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.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.