Created
December 3, 2013 11:11
-
-
Save cnicodeme/7767504 to your computer and use it in GitHub Desktop.
Simple script that add Java support in update-alternative. Takes the latest folder in /opt/java as the reference.
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 | |
# First of all, we check if the user is root | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
update-alternatives --install /usr/bin/java java /opt/java/$(ls -tr | tail -1)/bin/java 1 | |
update-alternatives --install /usr/bin/javac javac /opt/java/$(ls -tr | tail -1)/bin/javac 1 | |
update-alternatives --install /usr/bin/javadoc javadoc /opt/java/$(ls -tr | tail -1)/bin/javadoc 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment