How to Install Java in Arch Linux and Manjaro

3 min

This quick beginner’s guide explains the steps you need to install Java in Arch Linux and related distributions such as Manjaro.

There are two versions of Java (Java Development Kit – JDK and Java environment) is available Arch Linux (or any Linux). One is the free and open-source version implementation of Oracle Java SE – called OpenJDK. And the other one is Oracle JDK.

The OpenJDK implementation is available in Arch extra repo. But the Oracle JDK is available AUR only as it is provided by Oracle.

Let’s take a look how to install Java in Arch Linux.

This guide covers the following topics:

This guide uses the easy method using Yay AUR helper. Please install yay before you proceed using this guide.

Install Java in Arch Linux

Find the latest Java package in Arch

Open a terminal and run this command.

yay jdk

This command searches all packages with JDK in them. So, it would give you a huge list of packages. For new users, it is probably confusing to install. You can either use grep to filter out the list or go through them quickly.

List of packages with jdk in AUR
List of packages with jdk in AUR

Install Oracle Java in Arch

The Oracle package name is JDK. So, in the above list, it should be mentioned as “aur/jdk”. You can run the above command yay jdk and then enter the number to install.

Or, you can just run the below command and press enter when asked for providers to choose the default. See below.

yay -S jdk

Proceed with the installation and wait for it to finish. This would download ~180 MB of packages.

Install Oracle JDK
Install Oracle JDK

After the installation, check the Java version using java --version from the terminal.

Install OpenJDK in Arch

The OpenJDK package is available in Arch’s own extra repo. So you can use the Pacman to search, install easily.

First, search for the extact package name:

sudo pacman -Ss jdk
search Java package using pacman
search Java package using pacman

Then use the following command to install the jdk-openjdk package

sudo pacman -S jdk-openjdk
install OpenJDK
install OpenJDK

Proceed with the installation and wait for it to complete. After the installation, check the Java version using java --version from the terminal.

Check the Java version

You can check what Java version is currently used in your Arch system using below command.

java --version

The Arch utility archlinux-java can list the available Java environments using the below command.

archlinux-java status
java version check
java version check

Change Java Environment Version

If you are a developer and use Arch for development, you may have installed multiple Java versions for different projects. In that case, you can switch between multiple Java versions using the below command. You can get the actual package name using the archlinux-java status command.

sudo archlinux-java set <target java package name>


sudo archlinux-java set java-15-jdk

So. that’s all of it for this quick guide.

Wrapping Up

I hope this guide helps you to install OpenJDK or Oracle JDK in Arch Linux and related distributions. You can also try installing any other packages you may require because there are many Java implementations from different organizations. If you only require the Java runtime environment (JRE), not the entire Java Development Kit (JDK), you can try installing the headless version.

If you face any trouble, let me know in the comment box below.


Creator and author of Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Notify of

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

Oldest Most Voted
Inline Feedbacks
View all comments