Created
July 2, 2011 19:25
-
-
Save baloi/1061556 to your computer and use it in GitHub Desktop.
Set java version in Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd /System/Library/Frameworks/JavaVM.framework/Versions | |
CURJDK="`readlink CurrentJDK`" | |
echo Current JDK version: $CURJDK | |
if [ "$1" == "" ]; then | |
echo Installed versions: | |
ls | |
exit | |
fi | |
VERFOUND=`ls | grep $1 | head -n 1` | |
if [ "$VERFOUND" != "$1" ]; then | |
BASE="`basename $0`" | |
echo Error: Could not change JDK-- version $1 not installed! | |
echo Run $BASE without arguments to see a list of installed versions. | |
exit 127 | |
fi | |
echo You must now enter your Mac OS X password to change the JDK. | |
sudo ln -fhsv $1 CurrentJDK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment