Skip to content

Instantly share code, notes, and snippets.

@feldoh
Created April 10, 2014 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feldoh/10363995 to your computer and use it in GitHub Desktop.
Save feldoh/10363995 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