Created
May 15, 2018 10:42
-
-
Save isalgueiro/d4c2637ba8bfefb9ac3a9a5ee5095d51 to your computer and use it in GitHub Desktop.
This script update all Java related alternatives to point a manually installed JDK.
This file contains hidden or 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
#!/bin/bash | |
# Run update-alternatives for a manual installed JDK | |
JAVA_HOME=/opt/java/jdk1.8.0_152 | |
java_bins=(appletviewer extcheck idlj jarsigner java javac javadoc javafxpackager javah javap javapackager java-rmi.cgi javaws jcmd jconsole jcontrol jdb jdeps jhat jinfo jjs jmap jps jrunscript jsadebugd jstat jstatd jvisualvm keytool native2ascii orbd pack200 policytool rmic rmid schemagen servertool tnameserv wsgen wsimport xjc jar jmc jmc.ini jstack rmiregistry serialver unpack200) | |
for java_bin in ${java_bins[@]}; do | |
echo "Setting $java_bin..." | |
update-alternatives --install /usr/bin/$java_bin $java_bin $JAVA_HOME/bin/$java_bin 1 | |
update-alternatives --set $java_bin $JAVA_HOME/bin/$java_bin | |
done | |
echo "Done." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment