Skip to content

Instantly share code, notes, and snippets.

@SalomonBrys
Created August 13, 2014 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SalomonBrys/ffff5da9523fc15cc18d to your computer and use it in GitHub Desktop.
Save SalomonBrys/ffff5da9523fc15cc18d to your computer and use it in GitHub Desktop.
jdk-update-alternatives
#!/bin/sh
JHOME=$(pwd)
for jbin in jar java javac javadoc javah javap javaws jvisualvm keytool; do
if [ ! -x $JHOME/bin/$jbin ]; then
echo "ERROR: Cannot find: $JHOME/bin/$jbin"
else
update-alternatives --install "/usr/bin/$jbin" "$jbin" "$JHOME/bin/$jbin" 1
update-alternatives --set "$jbin" "$JHOME/bin/$jbin"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment