Find all existing JDK or JRE installations on RedHat, Centos or Fedora
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specifically JDK installations (contain 'javac' command) and not JREs: | |
yum --disablerepo=* whatprovides '*/bin/javac' | grep ilename | awk -F': ' '{print $2}' | sed 's/\/bin\/javac//' | |
# All JRE installations (those with bin/java but without bin/javac). Includes JREs that are included in JDKs. | |
for candidate in $(yum --disablerepo=* whatprovides '*/bin/java' | grep ilename | awk -F': ' '{print $2}' | sed 's/\/bin\/java//'); do | |
if [ ! -x "${candidate}/bin/javac" ]; then | |
echo "${candidate}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment