Created
August 31, 2017 08:58
-
-
Save deepankarb/5761bd1891ec30c8784de50ae68c733e to your computer and use it in GitHub Desktop.
Add an alternative JDK
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
if [ -z "$1" ] | |
then | |
echo "Please specify JDK path" | |
exit 1 | |
fi | |
if [ -z "$2" ] | |
then | |
PRIORITY=100 | |
else | |
PRIORITY="$2" | |
fi | |
echo "Priority: "$PRIORITY | |
JDK_PATH="$1" | |
for app in `find "$JDK_PATH/bin" -type f -executable` | |
do | |
app_name=$(basename $app) | |
man="$app_name"".1" | |
man_alt="$JDK_PATH""/man/man1/""$man" | |
man_path="/usr/share/man/man1/$man" | |
update-alternatives --verbose --install /usr/bin/"$app_name" "$app_name" "$app" "$PRIORITY" \ | |
--slave "$man_path" "$man" "$man_alt" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment