Manjaro Linux

How to install Java on Manjaro

Java is a software development platform that is based on an object-oriented programming language and has fewer implementation requirements. Java is safe and reliable; that’s why it is commonly utilized in game consoles, cell phones, laptops, scientific supercomputers, data centers, and other places where java applications are developed.

The Java Platform is a collection of programs that permits developers to create and run Java applications in an easy way. It consists of an engine (for execution), a compiler, and some additional libraries. Java was developed by Sun Microsystems, which was owned by Oracle Corporation after some time.

Why you should use Java on Manjaro

Here is the list of some of the significant features that can persuade you to use Java on your Manjaro system:

  • Java is one of the easiest programming languages to learn and utilized for server-side technologies such as GlassFish, JBoss, Apache, and much more.
  • You can write Java code once, and it will run on almost all of the computing platforms.
  • Java is a multi-threaded language with the automatic functionality of memory management.
  • As it is network-centric, it facilitates distributed computing.
  • It is employed to create Android applications, Scientific computing applications, Enterprise software, and the programming of Hardware devices and Big Data Analytics.

Now, let’s check the procedure of installing Java on Manjaro!

How to check if Java is installed on Manjaro

Before beginning the installation of Java, firstly, make sure if it is already installed on your system or not. For this purpose, you can utilize the below-given commands.

The “java” command with the “-version” option let you know about the version of Java that is installed on Linux-based systems such as Manjaro:

$ java -version

As in our case, we have not installed Java before; it will show the following output:

In the Manjaro terminal, you can also utilize the “which” command for locating the Java files which signify its presence on your system:

$ which java

Now, it is confirmed that Java is missing from the system. So, let’s move ahead and install JDK and JRE, which constitute Java on any operating system.

How to install Java Runtime Environment (JRE) on Manjaro

Java Runtime Environment or JRE is an installation package that offers an environment to execute (not develop) a Java application or program on a system. It comprises core classes, Java Virtual Machine (JVM), libraries, and supporting classes.

If you want to execute any Java application or program on Manjaro, you have to install JRE. To do so, firstly, we will check out the JRE versions which are available for the installation:

$ sudo pacman -sS java | grep jre

If you want to install a specific version of JRE from the list, then follow the below-given syntax:

$ sudo pacman -Sy jre[package-name]

For instance, to install open JRE 8, we will execute this command:

$ sudo pacman -S jre8-openjdk

In the other case, write-out below-given command for installing the latest version of JRE on your Manjaro system:

$ sudo pacman -S jre-openjdk

Wait for a few minutes, as the installation of JRE and its dependencies will take some time to install:

The error-free output indicates that JRE with all its related dependencies is successfully installed on our system.

How to install Java Development Kit (JDK) on Manjaro

After installing JRE, the next step is to install JDK on Manjaro. Java Development Kit or JDK offers an environment for creating Java applets and applications. JDK comprises a Java loader/interpreter, a Javadoc generator, a Java archiver, a Java compiler, and some additional Java development tools.

Before installing JDK, check out its available versions for your system:

$ sudo pacman -sS java | grep jdk

Now, write out the provided command for installing the latest version of JDK on Manjaro:

$ sudo pacman -S jdk-openjdk

In the other case, if you want to install a specific version of JDK from the available list, then follow the below-given syntax:

$ sudo pacman -Sy jdk[package-name]

For instance, to install open JDK 8, we will execute this command:

$ sudo pacman -S jdk8-openjdk

How to check Java version on Manjaro

If you followed the previously given steps correctly, then Java should now be installed on your system. To confirm its existence, type out the following command in the Manjaro terminal:

$ java -version

As you see, Java version “16.0.2” is installed on our system:

To find out the location of Java files, execute the “which java” command:

$ which java

Conclusion

Java is a versatile programming language that is utilized for a variety of tasks. It is widely used for building desktop, mobile, data centers, and scientific computing applications. Java comprises JDK, which is used to develop Java-based applications, JVM, and JRE, which assists in executing the java programming application. This post demonstrated how to install Java on Manjaro. Try it out on your system and enjoy working on this fantastic software platform!

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.