Created
September 20, 2019 08:12
-
-
Save kbl/7e88b5217a2c0a7808efad48246d9d16 to your computer and use it in GitHub Desktop.
Script that I'm using whenever I'm installing new JDK manually.
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
#!/bin/bash | |
JAVA_VERSION=13 | |
JAVA_DIR=/usr/lib/jvm/jdk-${JAVA_VERSION} | |
PRIORITY=11${JAVA_VERSION} | |
declare -A ALTERNATIVES_TO_UPDATE | |
ALTERNATIVES_TO_UPDATE=( | |
[jaotc]=bin | |
[jar]=bin | |
[jarsigner]=bin | |
[java]=bin | |
[javac]=bin | |
[javadoc]=bin | |
[javap]=bin | |
[jcmd]=bin | |
[jconsole]=bin | |
[jdb]=bin | |
[jdeprscan]=bin | |
[jdeps]=bin | |
[jexec]=lib | |
[jfr]=bin | |
[jhsdb]=bin | |
[jimage]=bin | |
[jinfo]=bin | |
[jjs]=bin | |
[jlink]=bin | |
[jmap]=bin | |
[jmod]=bin | |
[jps]=bin | |
[jrunscript]=bin | |
[jshell]=bin | |
[jspawnhelper]=lib | |
[jstack]=bin | |
[jstat]=bin | |
[jstatd]=bin | |
[keytool]=bin | |
[pack200]=bin | |
[rmic]=bin | |
[rmid]=bin | |
[rmiregistry]=bin | |
[serialver]=bin | |
[unpack200]=bin | |
) | |
# update alternative links | |
for tool in "${!ALTERNATIVES_TO_UPDATE[@]}" | |
do | |
dir=${ALTERNATIVES_TO_UPDATE[$tool]} | |
tool_path=$JAVA_DIR/$dir/$tool | |
if [ -x $tool_path ] | |
then | |
sudo update-alternatives --quiet --install /usr/bin/$tool $tool $tool_path $PRIORITY | |
else | |
echo Skipping $tool_path | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment