Skip to content

Instantly share code, notes, and snippets.

@chochos
Created March 19, 2014 16:40
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 chochos/9645773 to your computer and use it in GitHub Desktop.
Save chochos/9645773 to your computer and use it in GitHub Desktop.
A simple shell to switch between JDK 7 and 8 on Mac OS X. Save to `jvm`, chmod 700, put in your $PATH then `source jvm 8` (or 7)
#!/bin/bash
if [ "$1" == "7" ]; then
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
elif [ "$1" == "8" ]; then
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
else
echo Just pass 7 or 8 dude
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment