Recently we have started upgrade our java applications to start using Java 8. Wanted to quick and easy way to switch between different versions of Java.
If I was using a debian variant of Linux(Ubuntu/Mint etc.), I could have used
sudo update-alternatives --config java
But am using a Mac, hence wrote this …
export JAVA_HOME=`/usr/libexec/java_home -v "$1"`