Install Java Yum [Browser EXTENDED]

java -version If not installed, you’ll see command not found . List all Java-related packages:

java -version Sample output:

sudo yum install java-latest-openjdk-devel If multiple Java versions are installed, use alternatives to set the default. 4.1. List Configured Java Versions sudo alternatives --config java 4.2. Switch Default Version Select the number corresponding to the desired version. 4.3. Set javac (Compiler) Similarly sudo alternatives --config javac 5. Verify Installation Check Java runtime: install java yum

openjdk version "11.0.22" 2024-01-16 LTS OpenJDK Runtime Environment (Red Hat build 11.0.22+7-LTS) OpenJDK 64-Bit Server VM (Red Hat build 11.0.22+7-LTS, mixed mode, sharing) Check compiler (if JDK installed): java -version If not installed, you’ll see command

javac -version Many Java applications require JAVA_HOME . 6.1. Find Java Installation Path dirname $(dirname $(readlink -f $(which java))) Example output: /usr/lib/jvm/java-11-openjdk-11.0.22.0.7-1.el7_9.x86_64 6.2. Set JAVA_HOME Permanently Edit ~/.bashrc or /etc/environment : java -version If not installed