Skip to content

Instantly share code, notes, and snippets.

@feldoh
Last active August 29, 2015 13:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feldoh/b54b95edec0c585f7f71 to your computer and use it in GitHub Desktop.
Save feldoh/b54b95edec0c585f7f71 to your computer and use it in GitHub Desktop.
If you add functions like these to your .bash_profile then by simply typing the name of the function (in this case java7 or java8) into a terminal session, change the version of Java (or anything else) for just that session. This allows you to have whatever version of Java you need as default but freely switch for one time usage of tools like e.…
function java7
{
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home
export JAVA_HOME
}
function java8
{
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
export JAVA_HOME
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment