Skip to content

Instantly share code, notes, and snippets.

@warmwaffles
Created March 9, 2013 23:58
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 warmwaffles/5126398 to your computer and use it in GitHub Desktop.
Save warmwaffles/5126398 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage : jvm use [1.6|1.7]"
echo " jvm ls"
exit
fi
case $1 in
'use' )
export JAVA_HOME=$(/usr/libexec/java_home -v $2)
java -version
;;
'ls' )
/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d_\d\d" | cut -d , -f 1 | colrm 1 4 | grep -v Home
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment