Last active
August 29, 2015 14:08
-
-
Save trajakovic/4197af9f54e5d223f02b to your computer and use it in GitHub Desktop.
ubuntu / mint - java & javac automatic $JAVA_HOME by update-alternatives
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
#from http://stackoverflow.com/a/11542973/1137445 | |
Add to ~/.bashrc | |
JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:bin/javac::") | |
Install multiple versions of java with update-alternatives. This JAVA_HOME should be up-to-date if current version is switched. | |
Do not forget to restart terminal ;). |
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
echo "export JAVA_HOME=\$(readlink -f /usr/bin/java | sed \"s:bin/java::\")" >> ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run this script with
wget -qO- https://gist.githubusercontent.com/trajakovic/4197af9f54e5d223f02b/raw/java_home_auto_change.sh|bash