Install Java 8 on CentOS
This guide will show you how to install or update Java 8 on your system. Before downloading Java through the Linux command line, make sure you read the instructions thoroughly.
Oracle Java 11 is by far the most latest LTS version that can be downloaded and installed. Follow the steps below to install Oracle Java 11 on CentOS and Fedora systems.
Step 1: Download Latest Java SE Development Kit 8
Oracle provides both Java RPM packages and compiled source code. I’ve tried installing Java using rpm packages several times, but I’ve always run into problems. As a result, I choose to install Java from the compiled source code. Since then, I’ve successfully installed Java on CentOS and Redhat-based systems several times. To download the latest Java SE Development Kit 8 release, go to its official download page or use the shell commands below.
Step 2 – Install Java 8 with Alternatives
The alternatives command is used for maintained symbolic links. This command used to creates, removes, maintains, and display information about the symbolic links comprising the alternatives system. Let’s use the alternatives command to configure Java on your system. The alternatives command is available in chkconfig
package.
The number 4 corresponds to the newly installed Java version, so type 4 and hit enter.
Select java version
JAVA 8 has now been successfully installed on your system. We also propose utilizing alternatives to set up the javac and jar command paths.
Step 3: Verify the Installed Version
The PATH environment variable makes Java and javac binaries available. They can be accessed from any location on your system. Let’s see what version of the Java runtime environment (JRE) is installed on your system by running the command below.
Step 4: Configure Java Environment Variables
The majority of Java-based applications rely on environment variables to work. Set the Java environment variables with the commands below.
Set the environment variables JAVA_HOME, JRE_HOME, and PATH.
Add the above commands to /etc/bashrc or /etc/environment
to have the environment variables set automatically when the system reboots.
Saad Shafqat
Related posts
New Articles
Fix BlueBubbles Socket Connection Error: Easy Troubleshooting
BlueBubbles enables Android users to use iMessage, creating a bridge between Apple’s messaging system and non-Apple devices. However, users may…