osx
Bash functions written by Shawn Erickson for switching JDKs, still works in 2009!
# ***********************************************************************************
# Written by Shawn Erickson - shawn at freetimesw.com
#
# Feel free to use as you like but at your own risk :)
#
# Last Update: 2005y 08m 25d, 1:15 PM PST
#
# The following functions are meant for use with bash shell which is currently the
# default on Mac OS X 10.4 (starting with 10.3 IIRC) unless otherwise configured.
#
# If your shell is already set to use BASH then skip to install steps below.
# If you don't know what shell you are using by default then open a terminal
# window and type "echo $SHELL" and hit return. If it lists "/bin/bash" then
# you are using bash by default. If not you have the option of changing the
# default in terminal, globally for your user, or on demand.
#
# ***********************************************************************************
### Java Environment Functions ###
J_VERSIONS_DIRECTORY="/System/Library/Frameworks/JavaVM.framework/Versions"
J_COMMANDS_SUBPATH="Commands"
J_HOME_SUBPATH="Home"
function availableJVMs()
{
ls -1 $J_VERSIONS_DIRECTORY | grep ^[0-9].[0-9]
}
function listJava()
{
local jvms=$(availableJVMs)
echo "Available JVMs: "$jvms
echo "Current Java:"
java -version
}
function setJava()
{
