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, you’ll see command not found . List all Java-related packages: install java yum
sudo yum list installed | grep openjdk Remove a specific package: javac -version Many Java applications require JAVA_HOME