Skip to content

Instantly share code, notes, and snippets.

@warmwaffles
Last active December 14, 2015 16:19
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/5114575 to your computer and use it in GitHub Desktop.
Save warmwaffles/5114575 to your computer and use it in GitHub Desktop.
Need a quick way to switch java versions in Mac? ~> java_use 1.6
#!/bin/bash
/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d_\d\d" | cut -d , -f 1 | colrm 1 4 | grep -v Home
#!/bin/bash
export JAVA_HOME=$(/usr/libexec/java_home -v $1)
java -version
@warmwaffles
Copy link
Author

I have these sitting in my ~/bin directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment