Hi Guys, In this guide, we’ll show you how to install Oracle’s Java 8 programming language on CentOS 8 .
It’s an object-oriented language used for many of the applications and websites you come across today.
Installation
Just follow the steps below to get start
- Update your system
dnf update -y
- Install java-1.8.0-openjdk
dnf install java-1.8.0-openjdk
- Check if java is successfully installed
java -version
- After that, find Path of Java, set the JAVA_HOME variable, using the following command will give us a path so we can set the variable.
update-alternatives --config java
NOTE: In above screenshot, We will select the Path of the Java version you want.
if you have more than one version of Java, you can select between them then select the path of it.
For example: i will select java-11-openJDK then check the version again, it will be the selected one as shown below:
java -version
- Set Java’s Path in Your Environment
vim .bash_profile
- Export your Java path into the .bash_profile by adding the following to the bottom of the file. (Your path may look different from mine, and it’s not important that they vary.)
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el8_4.x86_64/jre/bin/java
- Refresh the bash_profile file
source .bash_profile
- Check the JAVA_HOME variable
echo $JAVA_HOME
Conclusion
In this article, we illustrated how to install Java 8 on CentOS 8
Thanks