Install Java 8 (OpenJDK 8) on Oracle Linux 8

In our last article we discussed on the installation of Java 11 on Oracle Linux 8. Today’s tutorial will be focused on the installation of Java 8 (OpenJDK 8) on Oracle Linux 8. Java 8 is the most common Java release with lots of cool features. If your application depend on Java 8 install using the steps in this article.

Some interesting features of Java 8 are:

  • Lambda Expressions, a new language feature, has been introduced in this release. This enables you to to treat functionality as a method argument, or code as data.
  • Method references which provide an easy-to-read lambda expressions for methods that already have a name.
  • Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces.
  • Repeating Annotations provide the ability to apply the same annotation type more than once to the same declaration or type use.
  • Type Annotations provide the ability to apply an annotation anywhere a type is used, not just on a declaration.
  • Improved type inference.
  • Method parameter reflection.
  • among other features

Enough with the theory, let’s now dive into the installation of Java 8 on Oracle Linux 8 server / machine.

sudo dnf install java-1.8.0-openjdk

Review dependencies to be installed and accept installation if you’re okay with it.

....
Transaction Summary
=======================================================================================================================================================
Install  2 Packages

Total download size: 33 M
Installed size: 121 M
Is this ok [y/N]: y

Setting default Java version

If you have more than one version of Java installed, use the the alternatives command to set the default version for your Applications.

List Java versions installed on Oracle Linux 8 machine.

$ sudo alternatives --list 
cifs-idmap-plugin   	auto  	/usr/lib64/cifs-utils/cifs_idmap_sss.so
libnssckbi.so.x86_64	auto  	/usr/lib64/pkcs11/p11-kit-trust.so
python              	auto  	/usr/libexec/no-python
python3             	auto  	/usr/bin/python3.6
ld                  	auto  	/usr/bin/ld.bfd
nmap                	auto  	/usr/bin/ncat
mkisofs             	auto  	/usr/bin/genisoimage
java                	auto  	/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.382.b05-2.el8.x86_64/jre/bin/java
jre_openjdk         	auto  	/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.382.b05-2.el8.x86_64/jre
jre_1.8.0           	auto  	/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.382.b05-2.el8.x86_64/jre
jre_1.8.0_openjdk   	auto  	/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.382.b05-2.el8.x86_64

Configure default java to use.

sudo alternatives --config java

From the list, select the Java version you want to use.

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
 + 1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.7.10-1.el8_1.x86_64/bin/java)
*  2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el8_1.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number: 2

Confirm with the java command.

$ java -version
openjdk version "1.8.0_382"
OpenJDK Runtime Environment (build 1.8.0_382-b05)
OpenJDK 64-Bit Server VM (build 25.382-b05, mixed mode)

You now have Java 8 installed on Oracle Linux 8. You can also check the guide on:

Explore More with CloudSpinx

Take a minute to have a look at our services. Here at CloudSpinx, we deliver robust solutions tailored to your needs.

Learn more about how we can support your journey with CloudSpinx.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

PHP is a recursive acronym that stands for Hypertext Processor. It is a popular general-purpose scripting language used in web […]

We previously installed Asterisk LTS 18 on Rocky Linux 9 and we saw that it can only be administered from […]

In this blog post we will install Asterisk 18 with FreePBX on Rocky Linux / AlmaLinux 9. Asterisk is a […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.